示例#1
0
 public void SendMessage(PeerMessage message)
 {
     if (Client.Connected)
     {
         NetworkStream nwStream    = Client.GetStream();
         byte[]        bytesToSend = ASCIIEncoding.ASCII.GetBytes("||" + message.ToJSON());
         //---send the text---
         nwStream.Write(bytesToSend, 0, bytesToSend.Length);
         nwStream.Flush();
     }
 }
示例#2
0
 public void HandlePeerMessage(PeerMessage message)
 {
     Console.WriteLine($"Message Recieved: {message.ToJSON()}");
 }