Hack 79. Advertise Any Service with Bonjour in Mac OS X
Use these two methods in Mac OS X to advertise any services you like.
While you can certainly use Howl [Hack #78] to advertise arbitrary Bonjour services from the command line, Mac OSX has a number of Aqua apps that will also do this for you. This hack presents two of the best available options.
5.18.1. Network Beacon
One good example is a freeware app called Network Beacon, available at http://www.chaoticsoftware.com/ProductPages/NetworkBeacon.html. It incorporates all of the functionality of Howl's mDNSPublish inside a simple, well-organized interface (Figure 5-28).
Figure 5-28. Network Beacon's main screen
Turning beacons on and off is as simple as clicking a checkbox. You can add as many beacons as you like, to whatever service, protocol, and port you need. It even allows you to advertise services that aren't local to your machine or network, as shown in Figure 5-28.
In this example, we're advertising the NoCat web site as the local Multicast DNS name nocat.local. This causes any Bonjour-enabled browsers on the local wireless network (such as Safari or Camino) to see a service called NoCat, which directs them to the IP address shown. As with Howl, you can change the URL that the user lands on by changing the Path= line in the Text Record box.
You can advertise any service you like by supplying the appropriate Service Type and Port Number. For example, to advertise an iTunes DAAP share, use _daap._tcp. as the Service Type, and 3689 as the port number. The little triangle button to the right of these fields provides a drop-down menu of common services and ports.
To make Network Beacon run whenever you are using your machine, simply add it to your Login Items in System Preferences. If you are interested in advertising Bonjour services, I highly recommend trying out this nifty free application.
5.18.2. mod_bonjour
Another quick and easy method for advertising web pages with Bonjour is to use mod_bonjour, part of the Apache installation on every Mac OS X box. Installations of Mac OS X prior to 10.4 will instead have a mod_rendezvous module. Add an entry like this to your /private/etc/httpd/httpd.conf file:
RegisterResource "Music on Example" "/Music/"
This registers a path with the given description for your local machine. Restart Apache by clicking Stop and then Start under System Preferences