bonjour
bonjour copied to clipboard
Service sometimes has no IP addresses associated
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 How easy is this to reproduce? Does it happen every time a service comes only?
@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...
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`);
}
});
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?