Skip to Content
Zero Configuration Networking: The Definitive Guide
book

Zero Configuration Networking: The Definitive Guide

by Daniel H Steinberg, Stuart Cheshire
December 2005
Intermediate to advanced
252 pages
8h 55m
English
O'Reilly Media, Inc.
Content preview from Zero Configuration Networking: The Definitive Guide

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

The com.apple.dnssd package exposes an abstract factory class, DNSSD, used to create the various types of 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 :

    • DNSSD

  • References to ongoing asynchronous operations :

    • DNSSDService

    • DNSSDRegistration

  • DNS Record Classes:

    • DNSRecord

    • TXTRecord

  • Callback Interface Classes , implemented by client:

    • BaseListener

    • RegisterListener

    • BrowseListener

    • ResolveListener

    • DomainListener

    • QueryListener

  • DNSSD Error Exception:

    • DNSSDException

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Zero Trust Networks

Zero Trust Networks

Evan Gilman, Doug Barth
Understanding and Troubleshooting Cisco Catalyst 9800 Series Wireless Controllers

Understanding and Troubleshooting Cisco Catalyst 9800 Series Wireless Controllers

Nicolas Darchis, Simone Arena, Francisco Sedano Crippa, Sudha Katgeri
SSH, The Secure Shell: The Definitive Guide, 2nd Edition

SSH, The Secure Shell: The Definitive Guide, 2nd Edition

Daniel J. Barrett, Richard E. Silverman, Robert G. Byrnes

Publisher Resources

ISBN: 0596101007Errata Page