bonjour icon indicating copy to clipboard operation
bonjour copied to clipboard

Failed to resolve service

Open Cir0X opened this issue 7 years ago • 2 comments

I'm trying to create a bonjour service which advertises a specific name, in order to make my node server discoverable from other devices

console.log("Starting bonjour service...");
var bonjourService = bonjour.publish({ name: 'agendaserver', type: 'http', port: 8080 });
bonjourService.start();

bonjourService.on('up', function () {
    console.log("Started bonjour service on " + bonjourService.fqdn + ":" + bonjourService.port);
    // => Started bonjour service on agendaserver._http._tcp.local:8080
    console.log("published = " + bonjourService.published) // => true
});

When I try to discover the service with avahi-browse -rk _http._tcp on the same machine, I get the following error:

Failed to resolve service 'agendaserver' of type '_http._tcp' in domain 'local': DNS failure: NXDOMAIN

What am I doing wrong?
Do I need to configure the underlying multicast-dns server?

Cir0X avatar Mar 02 '17 09:03 Cir0X

/**
 * Created by crazy on 17-4-27.
 */
var bonjourService = require('bonjour')()

console.log("Starting bonjour service...");
var bonjourService = bonjourService.publish({ name: 'agendaserver', type: 'http', port: 8080 });
bonjourService.start();

bonjourService.on('up', function () {
	console.log("Started bonjour service on " + bonjourService.fqdn + ":" + bonjourService.port);
	// => Started bonjour service on agendaserver._http._tcp.local:8080
	console.log("published = " + bonjourService.published) // => true
});

Today I use this lib ,and read source code.so I test Your code in Linux Mint 18.1.

Starting bonjour service...
Started bonjour service on agendaserver._http._tcp.local:8080
published = true

Test OK.What system that You use

But In fact I also get same result by "avahi-discover"

Error: org.freedesktop.Avahi.DNSNXDOMAIN: DNS failure: NXDOMAIN

@watson Did you test it OK?

Talbot3 avatar Apr 27 '17 08:04 Talbot3

This is My Second Day Try to solve it . I use avahi to publish my service,that OK. bu use bonjour this lib to publish my service seems ok,but could not get IpAddress.It seem lost enps0 interface. @Cir0X Did you solve it

Talbot3 avatar Apr 28 '17 08:04 Talbot3