mafintosh/multicast-dns

Detect services on two interfaces?

RichardFoss opened this issue · 2 comments

I'm using Windows 10 and I would like to detect services on an Ethernet interface and wireless interface. I have an audio device that can be connected directly to my computer or can be connected to a wireless router. However, I have problems when the npcap loopback adapter is enabled. So I would like to avoid attempting to find services on that. Is there a way to use the interface option to detect on two interfaces?

Some details on th issue. My understanding is that the problem comes from this line:

          socket.setMulticastInterface(opts.interface || defaultInterface())

While the socket listens to multiple interfaces, it send the discovery request to a single interface. So, devices attached to the other interfaces don't respond to the request.

I'm not familiar with the socket programming. Googling suggests two possible solutions (not sure which one is the orthodox one):

  1. When sending a message, consecutively call socket.setMulticastInterface(iface); and socket.send(...) for every interface.
  2. Have one socket per interface of interest.

Thank you very much for your help, much appreciated! The question was some time ago, and looking back to my code, I see that I moved on and used the mdns package for Apple, and the bonjour package for Windows in order to pick up services.