Beispiel #1
0
 /// <summary>
 /// 接待新连接
 /// </summary>
 public void Receive()
 {
     ReceptionUdp.BeginReceive((ar) =>
     {
         try
         {
             IPEndPoint ip = null;
             byte[] result = ReceptionUdp.EndReceive(ar, ref ip);
             if (result.Length == 111)
             {
                 Console.WriteLine(ip.ToString());
                 if (Index == Processors.Length)
                 {
                     Index = 0;
                 }
                 var token = new UToken(ip, Processors[Index], this);
                 Index++;
             }
         }
         catch (Exception e)
         {
             Console.WriteLine("Receive " + e.Message);
         }
         Receive();
     }, null);
     Console.WriteLine("接待中。。。");
 }
Beispiel #2
0
 public void ReceptionSend(byte[] buffer, int count, IPEndPoint Remote)
 {
     lock (ReceptionUdp)
     {
         ReceptionUdp.Send(buffer, count, Remote);
     }
 }