c# - RTSP Socks 协议无效响应
问题描述
我在RTSP Describe
使用 Socks 协议获得选项的响应时遇到问题。我得到了回应,选择但不是描述。例如,我关注了 wiki OPTIONS、DESCRIBE、SETUP、PLAY、TEARDOWN、GET_PARAMETER、SET_PARAMETER,我几乎在所有地方都得到了 200 响应,只是不在DESCRIBE
以下是实现:
StreamUtils.WriteLine(bufferedNetStream, stringBuilder.ToString());
RtspResponse rtspResponse = this.ReceiveResponse(bufferedNetStream);
这是缓冲流的读取实现:
public BufferedNetStream(TcpSocket sock, bool ownsSocket)
{
this.m_Socket = sock;
this.m_ownsSocket = ownsSocket;
}
public override void Write(byte[] buffer, int offset, int count)
{
try
{
this.m_Socket.Send(buffer, offset, count);
}
catch (Exception exception)
{
this.lastExcept = exception;
}
}
public static void WriteLine(Stream stream, string line)
{
byte[] bytes = Encoding.Default.GetBytes(string.Concat(line, "\r\n"));
stream.Write(bytes, 0, (int)bytes.Length);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
}
public override int Read(byte[] buffer, int offset, int size)
{
int num;
this.lastExcept = null;
if (this.dataBuffer != null)
{
int num1 = Math.Min(size, (int)this.dataBuffer.Length - this.dataOffset);
Array.Copy(this.dataBuffer, this.dataOffset, buffer, offset, num1);
offset += num1;
this.dataOffset += num1;
while (num1 < size)
{
this.dataBuffer = this.m_Socket.ReceivePacket();
if (this.m_Socket.LastException != null)
{
string stackTrace = this.m_Socket.LastException.StackTrace;
this.lastExcept = this.m_Socket.LastException;
num = num1;
return num;
}
else if (this.dataBuffer != null)
{
this.dataOffset = 0;
if ((int)this.dataBuffer.Length != 0)
{
int num2 = Math.Min(size - num1, (int)this.dataBuffer.Length - this.dataOffset);
Array.Copy(this.dataBuffer, 0, buffer, offset, num2);
num1 += num2;
offset += num2;
this.dataOffset += num2;
}
else
{
break;
}
}
else
{
num = num1;
return num;
}
}
num = num1;
}
else
{
num = 0;
}
return num;
}
解决方案
推荐阅读
- r - 将 diff 函数与 dplyr 中的 mutate at 一起使用
- html - 标题宽度:100% 导致水平滚动条
- python-3.x - Python 3 - VS Code(Windows)中的日期时间类/模块错误
- java - Camel SpringBoot POST返回对象不是JSON
- python - TypeError:列表索引必须是整数或切片,而不是 st
- pyspark - pyspark 无法使用 foreach 并行运行查询
- excel - Excel:如何有效地调节单元格,以便我可以识别观察计数小于某个数字的单元格?
- point-cloud-library - FPFH 描述符的 3D 对象识别不起作用 - 出了什么问题
- flutter - 是否可以在 Mobx 中拥有基于 DateTime.now 的计算属性?
- python - 如何在python中为一行中的多个输入设置默认值