bonjour icon indicating copy to clipboard operation
bonjour copied to clipboard

Hostname already in use error when calling bonjour.publish()

Open fttx opened this issue 8 years ago • 5 comments

Every time i execute bonjour.publish() i get this:

image

It happens even if i call bonjour.unpublishAll() and bonjour.destroy() before quitting

I'm on OS X El Capitan 10.11.6

fttx avatar Nov 15 '16 19:11 fttx

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.

soundprojects avatar Aug 06 '17 19:08 soundprojects

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

fttx avatar Aug 15 '17 13:08 fttx

I can confirm having the same issue on Sierra 10.12.6 (16G1212) using bonjour 3.5.0 through a node.js application.

thislooksfun avatar Mar 19 '18 04:03 thislooksfun

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".

utillity avatar Nov 06 '18 07:11 utillity

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.

oscadev avatar Mar 10 '20 13:03 oscadev