Yortw / RSSDP

Really Simple Service Discovery Protocol - a 100% .Net implementation of the SSDP protocol for publishing custom/basic devices, and discovering all device types on a network.

Home Page:http://yortw.github.io/RSSDP/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find any device on phone

AndreasReitberger opened this issue · comments

Hi,

thanks for making this library. I tried to to search my network to get a list of all available devices in my local network and the corresponding IP address.

I'm not sure if this is even the right package to achieve this.
This is what I've tried so far, however the list returned is always empty. I'm using Xamarin Forms.

using (var deviceLocator = new SsdpDeviceLocator("192.168.10.56")) { var foundDevices = await deviceLocator.SearchAsync(new TimeSpan(0,0,5)); // Can pass search arguments here (device type, uuid). No arguments means all devices. NetworkDevices = new ObservableCollection<DiscoveredSsdpDevice>(foundDevices); }

I also tried to get the IP of the device with this method.

var IpAddress = Dns.GetHostAddresses(Dns.GetHostName()).FirstOrDefault();
However this returns the internet ip, not the one from my router.

This is a desktop application. Is there a way to achieve the same result with this library?

image

Thank you!

Hi,
Sorry, it's not clear to me exactly what you're trying to do. RSSDP implements the SSDP protocol and will only find devices that are publishing themselves using that system. It's commonly implemented by media devices (DLNA) and routers (UPnP). It's quite likely that not every device on your network (or possibly any of them) will support SSDP, so I am not sure if when you say "get a list of all devices in my local network" you mean just ones supporting SSDP or truly everything. If you're really looking for everything on your network, this isn't the library for you (and I'm not sure what is, sorry). I'm also not sure what app the screenshot is of, or what solution it uses to find devices. It looks like ping results to me, so possibly it is doing a mass ping of addresses in your IP range, or maybe it's found the devices through some other mechanism and then pinged them, I can't tell - but it's not displaying anything that indicates SSDP is being used as a protocol (no friendly names, UID's, device types etc).

If you believe your devices should be publishing themselves via SSDP then... I'm actually not sure what your issue is. Your sample code looks correct as far as I can tell, assuming the IP address you've used is correct for your environment (but its seems to be). Assuming I'm not overlooking anything the only reasons I can think for that to return no devices is that your network doesn't support multicast udp (which seems to be a pretty rare issue) or that none of the devices you're looking for support SSDP as a protocol.

In terms of getting your local IP's (there may be more than one) you're probably better off using the NetworkInformation class and enumerating the adapters and ip addresses instead of using the DNS lookup - though it's possible the DNS lookup is working but returning multiple addresses and as you've just asked for the first one it isn't the one you want. Good IP Address selection needs more effort than that, but in your earlier code you've hard coded the IP and assumming you used the right one that should have worked.

Hi
Thanks for your reply. This cleared up things. I try to go with the mass ping instead. I already thought that this won‘t work with this library.
Thank you!
Kind regards,
Andreas