Bonjour: is there support in Juce? Has anyone used it?

Hi!

Now that Juce has OSC support, I was wondering if what I see many OSC-capable applications support is also supported in JUCE: Apple's bonjour service.

I don't use it much myself, but it seems to be common in software that wants to keep the IP and Port details hidden from users, and make networking a bit easier to use, no?

 

Thanks!

1 Like

We've talked about this ourselves, too, and agree it would be a neat feature that we'd like to implement!

1 Like

Great to hear you've thought about it, it makes very good sense to keep this implementation at the Juce library level, given that it will then allow seamless network interoperability across Win/OSX/iOS.

I for one will jump on it when it's there :)

2 Likes

+1
zeroconf can be very messy so something bundled into JUCE would be fantastic.

2 Likes

Hi guys!

Just bumping this thread, has there been any more consideration to adding Bonjour into JUCE? Would be a greatly appreciated feature, and open up a lot of options for clean clean user experience when connecting devices.

Thanks

I have used it on OSX and Linux using the Apple provided API. I built mDNSResponder for Linux to use it and it seems to work pretty well. It might be better to have a consistent experience on top of mDNSResponder/Avahi/Windows whatever though.

Any updates on this? Thinking about using OSC in an app. What alternatives have people used so far?

2 Likes

This would be awesome! I would be willing to help implement this.

It seems there is Apple provided Bonjour source code for both MacOS and Windows SDKs: https://developer.apple.com/bonjour/

After more searching on the forum (which I should’ve done in the first place before resurrecting this thread), I see that the JUCE team likely does not plan to implement a wrapper for Bonjour/Zeroconf network discovery, leaving this to the more heavyweight existing libraries.

If anybody is looking for a solution, JUCE has a basic NetworkServiceDiscovery implementation, but, as it has been pointed out, this is not intended to be the most robust implementation.

I did find that @anthony-nicholls has implemented a JUCE module wrapper for Bonjour:

Additionally, an example of using a Bonjour service in JUCE using Servus was shared by @benkuper:

I have not personally used any of these solutions, but seems there are some great options. I hope this is helpful to anyone else stumbling on this thread.

1 Like

Hello,
I’m the one implementing the Servus wrapper.
I have been updating it recently because most implementation (including Anthony’s one) seem to not include the IP lookup after hostname resolving.
That means that you end up with a hostname and port but no IP, which is kind of the one thing people are looking for…
I have modified Servus on windows to include this feature, and as I modified the Bonjour calls, I guess OSX should work as well if you recompile.
You can see the modified repo here : https://github.com/benkuper/Servus

and the implementation using “servus_ip” here: https://github.com/benkuper/Chataigne/blob/master/Source/Common/Zeroconf/ZeroconfManager.h

Also, JM-Celerier has implemented the avahi side of ip lookup here : https://github.com/jcelerier/Servus/commit/96563baa47fe82c516d5cecceda044a4a5c71536#diff-9b4e5f9a3c5e8b105fbb5677220c1670f22c07e6998ebe747d8739c9f2f326ba

Basically there is everything to make a complete JUCE module :slight_smile: It just need some time to merge and cleanup.

2 Likes

@TimArt thanks for linking to my github repo and post. To be honest I haven’t been giving it the attention it deserves due to work commitments. However if anyone wants to use it and needs help with it please do reach out to me on here. I may use it in commercial applications in the future, if I do it will force me to give it the TLC it requires.

2 Likes

@benkuper @anthony-nicholls Thank you both for your replies and updates on the status of your different zeroconf wrappers! I am excited to look into these and see what I can get working for my project.

@benkuper When you mention the problem that some implementations:

I am slightly confused about this as I thought this was one of the main purposes of a zeroconf implementation. I assume this IP lookup code already exists in the implementations of zeroconf (Bonjour, Avahi, etc.), and it’s just a matter of calling this from the wrapper implementation as you did in your modified version of Servus?

Also, @benkuper I enjoyed checking out some of your work displayed on your website, and it’s some amazing stuff! :slight_smile: I am really interested in this interactivity stuff with music and lighting and am currently working on an bodymovement-to-OSC kind of app myself. Your Chataigne seems like an amazing tool!

1 Like

Has there been any update on this? I was looking into @anthony-nicholls 's repo and was wondering if there is an easy way to resolve the IP of a discovered service.

Hi!

For it’s OSC Query implementation, I’ve started using libossia: GitHub - ossia/libossia: A modern C++, cross-environment distributed object model for creative coding and interaction scoring
Which also includes bonjour.

I’ve still had trouble depending on the server, in that I haven’t always been able to subsequently query an IP from the network name, but at least the network name I’ve consistently gotten.

Just worth adding since JUCE is used by many commercial products.
It’s LGPL or Cecill

Thanks for the tip. Before giving libossia a try, I actually stumbled upon this pack of a bunch of JUCE utilities. It’s a bit old and uses some deprecated components but does the job.