futomi / node-dns-sd

The node-dns-sd is a Node.js module which is a pure javascript implementation of mDNS/DNS-SD (Apple Bonjour) browser and packet parser. It allows you to discover IPv4 addresses in the local network specifying a service name such as _http._tcp.local. Besides, it allows you to monitor mDNS/DNS-SD packets.
MIT License
44 stars 11 forks source link

Does this work on Windows? #1

Open AshishShanker opened 6 years ago

AshishShanker commented 6 years ago

I am trying to use this lib to power service discovery on a Windows 10 machine and while I am able to publish a service and see it advertised through the dns-sd command through cmd, this library's .discover() method always returns an empty array. I am publishing a websocket service under _ws._tcp.local., but I tried looking for http services and they don't get discovered by this lib either.

Stepping through code, I do see DnsSdComposer.compose() return a valid buffer, and DnsSd._startListening() returns a valid _source_address, but when DnsSd._startDiscovery() sends a UDP datagram, nothing appears to happen.

I am going to try and dig deeper using protocol sniffing to see what really happens to that datagram, but just wanted to see if you might have some quick pointers for me.

Note that both the DNS client and server are on the same machine. The server is deployed as a Windows service written in node-windows and it creates a service advertisement upon startup using bonjour. I have Apple Bonjour SDK for Windows installed on the machine, and I am using IPv4.

futomi commented 6 years ago

I've missed this post. Sorry for that.

Thank you so much for your feedback.

As you mentioned, this module does not work well on Windows. Unfortunately, I don't know the reason. In my environment (Windows 10), sometimes this module works well, but sometimes this module does not work well.

I updated this module today. Though the update is not for this issue, the discovery process is improved. If possible, try the latest version of this module.

futomi commented 6 years ago

It seems that the Apple Bonjour installed on Windows 10 blocks the UDP communications from this module. I uninstalled the Apple Bonjour, this module appear to work robustly at least in my environment.