Beispiel #1
0
 /// <summary>
 /// Constructs a new UDPAsyncServer instance
 /// </summary>
 /// <param name="ep">The IP endpoint to bind to</param>
 /// <param name="receiveDelegate">Callback to user code whenever a datagram is received</param>
 public UDPAsyncServer(IPEndPoint ep, DatagramReceivedDelegate receiveDelegate)
 {
     _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     _socket.Bind(ep);
     _receiveCallback = new AsyncCallback(_receiveComplete);
     _sendCallback = new AsyncCallback(_sendComplete);
     _receiveDelegate = receiveDelegate;
     _receiveNext();
 }
Beispiel #2
0
 /// <summary>
 /// Constructs a new UDPAsyncServer instance
 /// </summary>
 /// <param name="ep">The IP endpoint to bind to</param>
 /// <param name="receiveDelegate">Callback to user code whenever a datagram is received</param>
 public UDPAsyncServer(IPEndPoint ep, DatagramReceivedDelegate receiveDelegate)
 {
     _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
     _socket.Bind(ep);
     _receiveCallback = new AsyncCallback(_receiveComplete);
     _sendCallback    = new AsyncCallback(_sendComplete);
     _receiveDelegate = receiveDelegate;
     _receiveNext();
 }