The rationale for Bonjour

This is the problem, two services want to find each other on a LAN, without making the user enter any cryptic numbers that change every time a computer or router restarts. I can't use Apple's libraries, and I want to understand the protocol (which they say is simple). Basically I'm looking for a BDG for Bonjour.

  • Beth Goza PRO 8y

    you have really neat handwriting :)
  • Dave Winer PRO 8y

    Thanks Beth. :-)
  • phil jones 8y

    It's also a good use of colour. Is that your iPhone as camera?
  • Ross_UK 8y

    Dave, is there a reason you can't use Apple's Bonjour SDK? It is available on Windows and OSX. Alternative wise, I think Howl (a different mDNS lib) has been killed, but they are now suggesting Avahi ( which appears to be very focused on Linux.

    Bonjour is an implementation of ZeroConf so if you want to look at the protocol you could check out
  • Dave Winer PRO 8y

    Not iPhone, scanner.

    I can't use their SDK. Nope.

    Whether it's available on Windows or not isn't the issue. I don't work at that level.

    Apparently it's not as simple as their marketing says it is?
  • Ross_UK 8y

    You could always tell us what you want the abstraction to be, at what level and in what language and somebody could put it together for you (with or without the SDK)?

    Alternatively, and I don't suggest this lightly, you could write to a multicast socket or even, and I reallty hesitate here, use the broadcast address to send 'notifications' of presence.
  • Dave Winer PRO 8y

    Ross_UK, I do all my work in the OPML Editor, which is GPL'd and runs on Mac and Windows. If Bonjour were baked into the environment by someone else, I wouldn't complain too loudly, but I would still like to know how the protocol works.

    Re your alternative, thanks -- that's what I'm thinking about doing. Is there a BDG for multicast? I had a phone talk with Don Park yesterday about this. He said there's a magic address that broadcasts a message to all nodes in your subnet. That sounds really cool and close to what I want to do.
  • Ross_UK 8y

    Dave, if your network address is (router will normally be in that case) then you should be able to *broadcast* to which will send it to all machines that have an address like 192.168.1.* but will (perhaps obviously) be UDP.

    If you want to multicast it is a matter of 'joining' an IP address in a known range and then treating is as a normal UDP socket, until you want to leave the group.

    Bonjour works by 'concensus' of the involved parties as to what their IP is because it is essentially replacing DNS by providing a protocol to allow for DNS over Multicast (hence the mDNS sometimes mentioned). This means that you can plug all of your machines into a router and they get addresses (typically 169.* addresses) even if the DHCP and DNS are down. Once a machine has an address this way, applications can register that they provide a particular service (such as _tcp.http for webservers) and other machines can query for them. This all sort of happens asynchronously and I believe, but can't quite remember, that queries can be reasonably long lived.

    If it is a fairly simple use, and limited to a local, personal network, it sounds like broadcast might be the easiest way for you to go, you just have to be smart about flooding your own network with potentially un-necessary traffic.
  • Ross_UK 8y

    "router will normally be in that case"
    should have been
    "router will normally be in that case"
  • Andre Radke 8y

    I found a list of protocols that Bonjour is based on here.

    One of the required building blocks, Multicast DNS (mDNS), apparently works by sending DNS queries to that magic broadcast address you mentioned.

    Unfortunately, since (m)DNS relies on the UDP protocol as the transport layer and not TCP, you can't use the tcp.* verbs in the OPML Editor to send and receive these broadcast messages.

    In fact, I don't see a way to implement this solely at the script level in the OPML Editor. As far as I can tell, you would at least need some kernel verbs to send and receive UDP messages (a.k.a. datagrams).
  • adin 8y

    From the 10Base-T guys:

    well, bonjour is easy as programming APIs go, but it does require some coding, at least on the publishing side.

    the program (on the mac) that we use to browse services is

    as far as coding goes, Apple has some very straightforward example projects (in Cocoa):

    there are also some books, but those get more into the nitty gritty of exactly how bonjour does its thing, instead of just how to implement it.

    hope your friend finds that useful, and good luck!
  • Dave Winer PRO 8y

    Andre, you're certainly the guy who could do it the right way, by baking the Bonjour library into the OPML Editor at the C level, and interfacing with some verbs (although for our Italian friends, maybe would be more fun).

    We could do another deal -- do you need a new iPod? A Mac Mini? A plane ticket to the US? :-)
  • Andre Radke 8y

    Thanks for the offer, but the only thing I could really use right now is -- more time. I'm going to take a look at the SDK, but I don't think I will be able to take on this project. Sorry.
  • Dave Winer PRO 8y

    No problemmo. :-)
  • Ross_UK 8y

    Is 10.1a8 the latest version? Is there an online CVS/SVN anywhere?
5 faves
Uploaded on October 24, 2007

Additional info

  • Viewing this photo Public
  • Safety level of this photo Safe
  • S Search
    Photo navigation
    < > Thumbnail navigation
    Z Zoom
    B Back to context