Пример #1
0
 public override void send(PlainMessage message)
 {
     if (client.Connected)
     {
         writer.WriteLine(message.ToString());
     }
     else
     {
         failed = true;
         throw new System.IO.IOException();
     }
 }
Пример #2
0
        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");
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
 public override void send(PlainMessage message)
 {
     writer.WriteLine(message.ToString());
 }
Пример #5
0
 public virtual void send(PlainMessage message)
 {
 }
Пример #6
0
 public override void send(PlainMessage message)
 {
     base.send(message);
 }