如何在ReceiveAsync之后处理数据

时间:2013-03-26 01:14:29

标签: c# websocket buffer

目前我在做:

WebSocketReceiveResult result = await Conn.ReceiveAsync(readBuffer, token);
for (int i = 1; i <= result.Count; i++)
{
    if (CurrentPosition+i > ProcessedPosition)
    {
        Console.ForegroundColor = ConsoleColor.Blue;
    }
    else
    {
        Console.ForegroundColor = ConsoleColor.Cyan;
    }
    Console.Write(readBuffer.Array[CurrentPosition+i]);
    Console.ResetColor();
}
CurrentPosition += result.Count;

我甚至在缓冲区中选择了正确的位置?我如何逐字节地分析它?

0 个答案:

没有答案