In association with heise online


The principle is simple - applications pass a set of service properties to a Bonjour demon, which forwards this information in a standardised form using multicast DNS packets on UDP port 5353 to subscribers on the same sub-network. Routers are normally set up such that they do not forward multicast DNS packets beyond the local network. The services announced by Bonjour are therefore not normally visible on the internet and privacy is maintained.

On the workstations the information takes the opposite route, from Bonjour to the client applications registered with Bonjour. This is how Apple's iTunes music player knows straight away if new shared music has been added to the network. If a resource is unshared, workstations are likewise informed and the client programs running on these workstations then remove the relevant entry from their lists.

dns-sd -B _http._tcp local.
Browsing for _http._tcplocal.
Timestamp A/R Flags if Domain Service Type Instance Name
17:23:26.634 Add 3 4 local. _http._tcp. hp LaserJet 4200 (00306EFDD4CB)
17:23:26.636 Add 3 4 local. _http._tcp. hp LaserJet 1320 series
17:23:26.636 Add 3 4 local. _http._tcp. macserver
17:23:26.636 Add 3 4 local. _http._tcp. iCals
17:23:26.637 Add 3 4 local. _http._tcp. rosinante
17:23:26.637 Add 3 4 local. _http._tcp. Mini-Archiv (dz)
17:23:26.638 Add 3 4 local. _http._tcp. Bonjour-Tools
17:23:26.638 Add 3 4 local. _http._tcp. Ingo T. Storms iMac G5
17:23:26.638 Add 2 4 local. _http._tcp. Christian Persson

dns-sd can be used to display all announced web services on the network.

Bonjour browsers offer a complete picture of announced services. A number of programs of this type, which list registered services by type, port or the IP address of the workstation offering the service, are available for Mac OS X. One of the more interesting is Observation Post, which can be used as an application launcher for Bonjour services. If the user clicks on an entry for another workstation, Observation Post opens the program associated with the Bonjour service on the local Mac - e.g. the shell for ssh connections or the printer setup utility for printer settings.

Browsers with graphical user interfaces are still rare on other operating systems. Java implementations or command line programs such as dns-sd are, however, available. Below, we will take a close look at the latter, as it is used in the same way on Mac OS X, Windows and Linux and because it allows users not only to discover services, but also to announce them.

Bonjour's functions are primarily implemented in the mDNSResponder demon – also known as mdnsd on some systems –, which sets up the relevant Bonjour installer on the computer (Windows, Linux or Mac OS X). If this demon is running, the computer automatically participates in Bonjour communication. No central mDNS server is required.

mDNSResponder does not include a user interface. Applications access its functions via the Bonjour framework and usually include switches for switching Bonjour on and off. In addition, the mDNSResponder demon can be used with the command line program dns-sd. This is included in Mac OS X versions 10.4 and higher, and Suse versions 10.1 and higher (instructions for adding dnssd to older versions of Suse are given in the box Suse says Bonjour). BonjourSetup for Windows does not include dns-sd, however it is a component of the Bonjour SDK for Windows. The Windows 2003 SDK, Visual Studio 2003 and the Driver Development Kit are required to compile the source code. Users who do not wish to install this extensive package can use JmDNS in place of the Bonjour SDK.

In order to display, for instance, web services on the network, the user launches dns-sd with the -b switch and enters a domain (usually local) and a service type, such as "_http._tcp" for web servers. Bonjour uses the .local domain by default in order to be able to manage services via DNS.

The number of service types now registered is enormous. This may be because registering a service type is so easy - an email containing just a handful of details is sufficient.

After launching, dns-sd hooks permanently into mDNSResponder and after a short wait supplies a table which it updates continuously until the program is terminated using Ctrl+C.

If dns-sd is started with the -R switch, a new service can be registered. This allows curious developers to obtain initial experience with Bonjour, without having to develop their own programs. The command also takes a label parameter (e.g. WindowsWebServer), the service type and the port number. The final parameter, a descriptive text field can be left blank:

dns-sd -R WindowsWebServer _http._tcp. local. 80 ""

Bonjour then checks whether the label WindowsWebServer is still available for the announced service type, registers the service where appropriate and reports "Name now registered and active" - the service is now visible on the network as long as dns-sd is running. The command format is only slightly different with JmDNS:

java -jar jmdns.jar -rs WindowsWebServer _http._tcp  local. 80

This command registers a web service called WindowsWebServer and leads browsers to the dz folder via port 80, so that they automatically open the index file deposited in this folder.

Print Version | Permalink:
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit