Esempio n. 1
0
 private static void Sender()
 {
     while (true)
     {
         Console.Write("Local Host>  ");
         string str = StandardIOWrapper.ReadLine() ?? "EXIT";
         if (str.Trim().ToUpper() == "EXIT")
         {
             return;
         }
         Send(str);
     }
 }
Esempio n. 2
0
 private static void Receiver(CancellationToken token)
 {
     while (true)
     {
         for (byte i = 0; i < 36; i++)
         {
             if (NetworkStream.DataAvailable)
             {
                 string data = Receive();
                 if (data != null)
                 {
                     StandardIOWrapper.WriteLine("Remote Host>  " + data);
                 }
             }
             token.WaitHandle.WaitOne(5000);
             token.ThrowIfCancellationRequested();
         }
         SendHelloPacket();
     }
 }