bonjour
bonjour copied to clipboard
Hostname already in use error when calling bonjour.publish()
Every time i execute bonjour.publish() i get this:
It happens even if i call bonjour.unpublishAll() and bonjour.destroy() before quitting
I'm on OS X El Capitan 10.11.6
Can you verify that your application has the time to unpublish the services? What system are you running on? Electron? Ionic? Node?
If you want an answer to your question, please take some time to provide us sample code, things you tried etc.
Originally i got it with electron.
Now i tried to copy the example from the README.md and run it with node example.js
and still got the same error. I'm using macOS Sierra 10.12.6
I can confirm having the same issue on Sierra 10.12.6 (16G1212) using bonjour 3.5.0 through a node.js application.
I have same issue. Problem is that it seems to tear down my application. There is no support for a callback for error-handling on .publish!
I do the following on window closing:
w.on('closed', () => {
console.log(`Unregistering GCU in network...`);
bonjour.unpublishAll(() => {
bonjour.destroy();
console.log(`Completed unregistering GCU in network`);
});
which works "most of the time".
I also have the issue of "this hostname is already in use, renaming to [same name with last number changed]". Only happens once per computer boot. I boot up, run yarn dev on electron project (or node on server script, same thing), and it gives me that warning and changes my Mac's hostname. Rerunning the app doesnt cause the issue until I restart again.