Home Forums Support Can I send UDP to a specific adapter ? Reply To: Can I send UDP to a specific adapter ?

#2785
Anonymous
Inactive

To listen on a specific adaptor for UDP use:

//Select local host IP Address and port 10000
IPEndPoint desiredLocalIPEndPoint = IPTools.ParseEndPointFromString("127.0.0.1:10000");

//Create a UDP listener instance
ConnectionListenerBase udpListener = new UDPConnectionListener(NetworkComms.DefaultSendReceiveOptions, ApplicationLayerProtocolStatus.Enabled, UDPConnection.DefaultUDPOptions);

//Start listening
Connection.StartListening(udpListener, desiredLocalIPEndPoint);

Sending is currently handled by the operating system being used, we do have support for specific adaptor binding but it is not accessibly publicly at the moment. If you provide an example when this does not work we will of course consider extending the library to support this feature.

Kind regards,
Marc