void _connection_OnDataReceived(object sender, ServerData receivedData) { Log(string.Format("client <= server: {0} bytes received", receivedData.BytesRead)); Log(receivedData.ToString()); }
/// <summary> /// Indicates when data is ready to be received from the server. /// </summary> public void Receive() { while(Connected) { var data = new ServerData(RecieveBufferSize); _socket.BeginReceive(data.Buffer, 0, data.BufferSize, SocketFlags.None, ReceiveCallback, data); _receiveDone.WaitOne(); _receiveDone.Reset(); } }