UDP/TCP and Bonjour?

I have a desktop app that’s using UDP broadcast to find other users running it on the same network, then switching to TCP to send data back and forth between the two apps. It generally works well, but I’ve had a fair number of reports from users that they’re unable to connect with each other, even when they are on the same subnet. Sometimes I expect they’re not, other times their router may be blocking UDP broadcasts, or their network is behind a proxy or other hard-nosed security, and other times are just a mystery…:slight_smile:

So I’m considering trying Bonjour to scan for other users running the same app and then connecting via TCP. Theoretically that should make things easier and more reliable for the users and for me, yes? I’d be using the MBS Network/Bonjour classes.

Any opinions one way or the other?

If I do this, would I need to register a service name with ICANN so that my app’s availability doesn’t get confused with other services?

Thanks!

I neglected to mention that my app is cross-platform Mac and Windows, thanks!

First, I don’t think you need to register your app with ICANN, but it is probably not a bad idea. But I don’t think it’s a requirement.

MonkeyBread has some excellent Bonjour classes. Take a look at those. It will make implementation much easier and it’s cross platform.

Just FYI that if the routers are blocking UDP traffic bonjour may not do any better as it is UDP based
It uses UDP multicast
http://en.wikipedia.org/wiki/Multicast_DNS

MBS Network Plugin, see documentation here:
http://www.monkeybreadsoftware.net/pluginpart-dnsservice.shtml

Those classes work for Mac and Windows.
For Linux we have extra classes:
http://www.monkeybreadsoftware.net/pluginpart-avahi.shtml

People will probably not simply disable bonjour service as so many things nowadays require it.

[quote=175685:@Christian Schmitz]MBS Network Plugin, see documentation here:
http://www.monkeybreadsoftware.net/pluginpart-dnsservice.shtml

Those classes work for Mac and Windows.
For Linux we have extra classes:
http://www.monkeybreadsoftware.net/pluginpart-avahi.shtml

People will probably not simply disable bonjour service as so many things nowadays require it.[/quote]

One thing you will absolutely, 100% want to do on the Windows side is check that Bonjour is installed. A LOT of Windows users do not have it installed. The Bonjour Print Drivers for Windows is a free download from Apple. You may be tempted to include this installer with your app distribution. DON’T! Apple’s terms for doing this are rather crazy for a free piece of software. I looked into it but you will need to report to Apple how many downloads you have had, etc.

In the past, I’ve made the user go get it themselves. I just completed changes that if Bonjour is not installed, then I have an HTTPSocket that grabs it from Apple’s website, downloads it and launches the Installer. And thanks to a new Initialize method that Christian just added, you can install Bonjour and then call the Initialize method in Christian’s classes and not have to quit and restart your application.

If you would like a copy of what I have done to pull Bonjour from Apple’s website - let me know. It looks like a simple URL but you actually get sent through about 3 or 4 different redirects that are not apparent at first. It seems to be working pretty well for me now…

Thanks Jon, for the Windows suggestions, I haven’t looked into Apple’s Bonjour for Windows terms. And yes, I’d love to see your code for getting Bonjour from Apple’s website!