Chapter 8. Using the Java APIs
Starting in Mac OS X 10.3.9, new APIs enable Java software to advertise and discover services on the network using Zeroconf’s DNS Service Discovery. The same Java DNS-SD APIs are also available in Bonjour for Windows, Bonjour for Linux, Solaris, *BSD, etc., enabling Java software to make use of Zeroconf’s DNS Service Discovery across a wide range of platforms, not just on Mac OS X. In this chapter, you will take a quick look through the APIs, see short examples of how to register, browse for, add TXT records to, and resolve services, and finally see a complete example of using Java DNS-SD in a tic-tac-toe game.
Understanding the APIs
com.apple.dnssd package exposes an abstract
DNSSD, used to create the various
DNSSDService objects, two classes used to
manipulate DNS records, a collection of interfaces that are implemented as appropriate
by client code to receive callback messages, and an exception:
Factory Class :
References to ongoing asynchronous operations :
DNS Record Classes:
Callback Interface Classes , implemented by client:
DNSSD Error Exception:
The pattern for using the APIs will most often consist of calling a
static method from the
DNSSD factory class, passing in an instance of a class that implements the appropriate interface to receive callback ...