public void startListening(dataHandler handler) { listening = true; while (listening) { byte[] data = new byte[1456]; socket.ReceiveFrom(data, ref myPort); handler.Invoke(data); } }
public void startListening(dataHandler handler) { listening = true; while (listening) { byte[] data = new byte[1500]; socket.Receive(data); handler.Invoke(data); } }
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); } }