Read asynchronously data from NetworkStream with huge amount of packets
问题 In my application every packet has 2 bytes length on the start. However after some time application starts receiving length less than zero. In synchronous client everything works correctly, but it's too slow. I'm 100% sure in Server everything is correct. Connect: public void Connect(IPAddress ip, int port) { tcpClient.Connect(ip, port); stream = tcpClient.GetStream(); byte[] len_buffer = new byte[2]; stream.BeginRead(len_buffer, 0, len_buffer.Length, OnDataRead, len_buffer); } OnDataRead: