mdns
mdns copied to clipboard
Explicitly set IP_MULTICAST_IF to ensure that queries are sent on specified NIC
When using a multihomed environment, the library allows the user to specified a NIC to search for a particular service; however without setting IP_MULTICAST_IF, the OS is free to send the query on an interface of its choosing. This change forces the send to occur on the user specified interface. This change works also when using INADDR_ANY.
I have tested this on windows and can confirm it works perfectly. I was having this exact issue when running discovery on multiple NICs.
@dylanmckay is there something holding this PR up? I would be happy to help get it merged. I haven't tested this patch against the latest version, though there doesn't appear to be any conflicts (according to GitHub). The MDNS search doesn't work properly for me without this change.
I have once again tested these changes against 3.0.0 and it works perfectly (on Windows. I have not tested on Linux yet).