private void OnReceived(object sender, TcpNetworkReceiveEventArgs eventArgs) { if (Status != ClientNetworkStatus.Connected) { return; } lock (m_MessageLocker) { m_Messages.Add(eventArgs.bytes); } }
private void OnReceived(object sender, TcpNetworkReceiveEventArgs e) { lock (m_MessageLocker) { ServerLogMessage message = new ServerLogMessage(); int id = BitConverter.ToInt32(e.bytes, 0); byte[] contentBytes = new byte[0]; if (e.bytes.Length > sizeof(int)) { contentBytes = new byte[e.bytes.Length - sizeof(int)]; Array.Copy(e.bytes, sizeof(int), contentBytes, 0, contentBytes.Length); } message.ID = id; message.Client = e.client; message.Message = contentBytes; m_ReceivedMessages.Add(message); } }