public override void send(PlainMessage message) { if (client.Connected) { writer.WriteLine(message.ToString()); } else { failed = true; throw new System.IO.IOException(); } }
public override void send(PlainMessage message) { var n = from node in Nodes where node.address == message.address select node; if (n.Count() != 0) { n.First().writer.WriteLine(message.ToString()); } else { Console.WriteLine($"Node with address '{message.address}' not found"); } }
private void HandleClientRequest(TcpClient client) { NetworkStream stream = client.GetStream(); System.IO.StreamReader reader; System.IO.StreamWriter writer; reader = new System.IO.StreamReader(stream); writer = new System.IO.StreamWriter(stream); writer.AutoFlush = true; dynamic entry = new ExpandoObject(); entry.reader = reader; entry.writer = writer; var m = reader.ReadLineAsync(); m.Wait(); PlainMessage msg = new PlainMessage(m.Result); entry.address = msg.sender; Nodes.Add(entry); }
public override void send(PlainMessage message) { writer.WriteLine(message.ToString()); }
public virtual void send(PlainMessage message) { }
public override void send(PlainMessage message) { base.send(message); }