VLC's mDNS lookup fails due to an issue in libmicrodns' implementation
I was trying to render from VLC to a Chromecast I have on the local subnet and it appeared VLC couldn't find my Chromecast.
Because Chrome was successfully talking to my Chromecast, I decided to sniff around in Wireshark & tcpview, and lo and behold, I couldn't see any mDNS packet sent by VLC, whereas many mDNS packets were sent by Chrome.
Some ipython & Visual Studio sparring later, I came to the realization that the sendto
-call, despite succeeding, did not send any packet I could see on Wireshark, and this happened only for multicast destinations.
further investigation
I decided to compare Chrome's and _libmicrodns' _code, and in the differences I found a setsockopt(IP_MULTICAST_IF)
-call that existed in Chrome but did not exist in libmicrodns.
Apparently a socket is not capable of sending multicast packets on multiple interfaces simultaneously, and mine was sending on the friggin' loopback interface.
conclusion
Chrome opens a socket per network interface and uses all of them for discovery, see here. Not sure what the most reasonable solution for libmicrodns would be.