private void ReceiveHeader() { var buffer = ReceiveBuffer.Create(4); lock (_connection) { _connection.BeginReceive(buffer.Buffer, buffer.ReceivedBytes, buffer.Buffer.Length, SocketFlags.None, _readHeaderCallback, buffer); } }
private void ReceiveBody(int size) { var buffer = ReceiveBuffer.Create(size); lock (_connection) { _connection.BeginReceive(buffer.Buffer, buffer.ReceivedBytes, buffer.Buffer.Length, SocketFlags.None, _readBodyCallback, buffer); } }