예제 #1
0
 public void startListening(dataHandler handler)
 {
     listening = true;
     while (listening)
     {
         byte[] data = new byte[1456];
         socket.ReceiveFrom(data, ref myPort);
         handler.Invoke(data);
     }
 }
예제 #2
0
 public void startListening(dataHandler handler)
 {
     listening = true;
     while (listening)
     {
         byte[] data = new byte[1500];
         socket.Receive(data);
         handler.Invoke(data);
     }
 }
예제 #3
0
 public void startListening(dataHandler handler, System.Action exceptionHandler)
 {
     while (true)
     {
         byte[] data = new byte[1500];
         try
         {
             socket.Receive(data);
         }
         catch (Exception e) {
             exceptionHandler.Invoke();
             break;
         }
         handler.Invoke(this, data);
     }
 }