C# Socket.BeginReceive/EndReceive

The order in time should be: BeginReceive for message length EndReceive for the completion of #1 BeginReceive for the message body EndReceive for the completion of #3 E.g. not using callbacks you could have: var sync = socket.BeginReceive(….); sync.AsyncWaitHandle.WaitOne(); var res = socket.EndReceive(sync); sync = socket.BeginReceive(….); sync.AsyncWaitHandle.WaitOne(); var res2 = socket.EndReceive(sync); But then, you would … Read more