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

Discovery not working #9

Open arys opened 3 years ago

arys commented 3 years ago

Hello, I can't resolve any services. Can you please help me with this? My code:

mDnsSd.discover({
  name: "_kitchen._tcp.",
}).then((device_list) => {
  console.log(device_list);
}).catch((error) => {
  console.error(error);
});

Output is empty array, but I know that service is running

Screen Shot 2021-06-06 at 13 21 26

I am using electron: 11.4.6

beezly commented 9 months ago

You need to append local to your request. DNS-SD specifies that requests ending in .local are sent multicast to your network (and therefore all devices on the local network will receive them). Requests without .local are sent unicast, and will use your hosts resolver to lookup _kitchen._tcp., which almost certainly is not resolvable and will not be sent to a device on the network.