UPNP discovery failures caused by Windows SSDP Discovery Service changing default multicast interface/route
I have an application that multicasts SSDP UDP packets for discovering devices. I was having an issue whereby intermittently I would stop seeing my UDP packets going out over the wire, which would lead to the failure to discover SSDP devices on my single physical network interface. After debugging it further I discovered that the network interface my packets are sent to is constantly being cycled by Win32/system whenever the Windows SSDP Discovery service is running. I have only a single physical network but two virtual network adapters installed by VMware on the Host OS - these adapters are 'enabled' but are not being used and there are no VMs running. However my UDP multicasts are being sent to these virtual adapters intermittently instead of my single physical network interface. I've reproduced the same behavior by disabling the virtual network adapters and adding a WiFi interface. The common behavior is that the SSDP service is altering the default interface/route that Win32 applications' UDP multicasts are being sent to, in addition to which interfaces incoming SSDP replies are filtered from.
In multicast programming it's typical for an application to specify INADDR_ANY (0.0.0.0) as the multicast interface for the TCP/IP socket it creates. This is supposed to lead to the default interface being used for sending and receiving multicast packets. And this works when my applications first starts...however, while the application runs the default interface is constantly being changed/cycled. The problem goes away if I stop the Windows SSDP Discovery service. A temporary workaround is to explicitly specify which interface is to be used for multicasts via the setsockopt(IP_MULTICAST_IF) and setsockopt(IP_ADD_MEMBERSHIP) for the TCP/IP sockets my app creates - however I'd like to find a permanent solution that doesn't require this.
I created a stackoverflow article with more details and sample code. I'm unable to insert the link due to having a new account here but you can find it by googling "Windows SSDP discovery service throttling outgoing SSDP broadcasts"
For this issue, I am trying to invoke someone experienced to help look into it, it may take some time and as soon as we get any result, we will post an update to here.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.