这是我阅读输入流的方式
while (!stopRequested && stream.CanRead)
{
byte[] buffer = new byte[READ_BUFFER_SIZE];
Int32 bytesRead = stream.Read(buffer, 0, READ_BUFFER_SIZE);
byte[] response = new byte[bytesRead];
Array.Copy(buffer, response, bytesRead);
responsesStream.AddRange(response); //push the bytes onto the dataStream
ParseStream(responsesStream); //attempt to parse
}
如果你有一个类似以下示例
的规范,你如何实现一个有效的二进制协议解析器?简明的代码示例或链接高度赞赏。 THX