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(); } }
public void HandlePeerMessage(PeerMessage message) { Console.WriteLine($"Message Recieved: {message.ToJSON()}"); }