Esempio n. 1
0
 public void SendTcpMessage(NetworkMessage networkMessage)
 {
     byte[] data   = NetworkConverter.Serialize(networkMessage);
     byte[] header = BitConverter.GetBytes(data.Length);
     _client.GetStream().Write(header, 0, header.Length);
     _client.GetStream().Write(data, 0, data.Length);
 }
Esempio n. 2
0
 private void sendMessage(NetworkMessage networkMessage)
 {
     networkMessage.playerInfo.userId = this.clientId;
     byte[] data   = NetworkConverter.Serialize(networkMessage);
     byte[] header = BitConverter.GetBytes(data.Length);
     client.GetStream().Write(header, 0, header.Length);
     client.GetStream().Write(data, 0, data.Length);
 }