bonjour icon indicating copy to clipboard operation
bonjour copied to clipboard

Service sometimes has no IP addresses associated

Open jonathan-roy opened this issue 8 years ago • 4 comments

Sometimes when a service is up (often after the service has just restarted) it has no IP address associated: service.addresses is empty.

Is there an easy way to workaround this issue?

jonathan-roy avatar Sep 30 '16 11:09 jonathan-roy

@jonathan-roy How easy is this to reproduce? Does it happen every time a service comes only?

watson avatar Sep 30 '16 11:09 watson

@watson It does not happen when I start the Bonjour browser but then it happens quite often when a machine is restarted. But we are using custom services on a very busy network so I'm not sure if it's really a bug from the bonjour package or an issue from our environment. I'll try to investigate on that...

jonathan-roy avatar Sep 30 '16 12:09 jonathan-roy

Ok you can easily reproduce it using the following code, then restarting a service (in my case, I don't reboot the machine but just restart the Bonjour service):

const bonjour = require("bonjour")();

const browser = bonjour.find({"type": "http"}, (service) =>
{
    if (service.addresses.length === 0)
    {
        console.log(`${service.host} has no IP address`);
    }
});

jonathan-roy avatar Sep 30 '16 12:09 jonathan-roy

The same problem here, whenever I restart the device and check services about 15 seconds later, the service response has no IP, like it didnt have time yet. If I go back and check again, there it is. Is there a way to update a listen again to a specific service?

julianCast avatar Sep 18 '17 08:09 julianCast