huin/goupnp

Unable to find devices most of the time

smares opened this issue · 7 comments

I just started using this library and initially was very happy that clients, errors, err := av1.NewAVTransport1Clients() found my Samsung TV and Teufel loudspeakers, but soon after that, it stopped working and clients was empty. After like 20 runs, it worked again, but eventually it's no longer finding anything. My system is Windows 10. Before using your library, I played around with Developer Tools for UPnP Technologies (http://www.meshcommander.com/upnptools) and their "Device Spy" that works all the time, so it doesn't appear to be a limitation of my OS or network / firewall. Any idea what might be wrong? Should I use Wireshark to inspect the traffic or do you recommend something else?

huin commented

The Wireshark captures would be particularly useful. Specifically comparing the working tool does versus what goupnp does.

Great, now I cannot reproduce the issue after a PC reboot. 😅

By the way, device.go has RequestSCDP(). Shouldn't this be RequestSCPD()?

huin commented

Dang, that's a pain. I was vaguely wondering if it's a lack of IPv6 support in the library.

And yes, looks like that's a typo. I guess I should alias that (but retain old for compatibility). Thanks for spotting it :)

Hmm, not sure if it's an IPv6 problem. Wouldn't that mean that it should never find the devices?

Do you have experience with Wireshark? What should I be looking for? Even though I turned off all services and programs that connect to the Internet, as soon as I start recording, I get lots of entries. I thought UPnP is mostly UDP at least when it comes to discovery, but that SDK I mentioned seems to be doing several TCP requests to my intranet as well.

huin commented

The IPv6 theory is based on a couple of things: one is that this library hasn't been updated to support IPv6, and the other is pondering if the appearance and disappearance of the problem you experienced was maybe an IPv4 DHCP lease expiring and not being renewed (where IPv6's own auto configuration would probably survive). But the latter being a cause is a complete guess.

I've used Wireshark, although a bit rusty. What might work best is to apply a filter for UDP packets that have port 1900 as either source or destination. That should cut out most of the noise.

Closing as I really cannot reproduce. In case I can, I'll be back with Wireshark dumps. :)

huin commented

Thanks, and please do :)