rdavisau / sockets-for-pcl

Cross-platform socket API for Xamarin iOS/Android/Forms, Xamarin.Mac/MonoMac, Windows Phone 8/8.1, Windows Store and Windows Desktop.
MIT License
224 stars 72 forks source link

Using CommsInterface.GetAllInterfacesAsync() to use with StartListeningAsync() #156

Open melucas opened 5 years ago

melucas commented 5 years ago

Hello,

In my Xamarin forms project in a view model, I can successfully find the first connected network interface using CommsInterface.GetAllInterfacesAsync() (as per the example in the readme file).

When I pass the interface object to the UdpSocketReceiver StartListeningAsync(port, ni), the connection does not fire the MessageReceived event. If the network interface object is null, or StartListeningAsync is called with just the port number, the MessageReceived event fires with the received data from the UDP Server.

I would like to be able to tell the UdpSocketReceiver which network interface to listen on because the server will always be on a WiFi connection. There is no need to listen to the mobile network.

Any idea how to make this work?