The Artima Developer Community
Sponsored Link

Java Community News
Register and Discover Services with ZeroConf's Java API

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Register and Discover Services with ZeroConf's Java API Posted: Mar 24, 2006 8:32 AM
Reply to this message Reply
Summary
Apple's Zero Configuration Networking ("Rendezvous" or "Bonjour") facilitates spontaneous discovery and communication not only between devices, but also between software services running on different network nodes on a LAN. A recent article looks at how to register and discover services with ZeroConf's Java APIs.
Advertisement

Recent years have witnessed a proliferation of spontaneous networking technologies, allowing devices and software sharing a multicast network segment to discover and communicate with each other without requiring prior configuration.

Such spontaneous networking technologies are often built as extensions to an existing networking technology. For instance, Jini provides dynamic networking capabilities by extending Java's RMI and multicast capabilities; UPnP extends Web services and XML to provide device discovery and configuration; and Apple's Zero Configuration Networking (also called "Rendezvous" or "Bonjour") extends DNS to offer similar networking services.

While much of these technologies overlap in functionality, each also has its competitive advantage in certain niches. One niche advantage of ZeroConf is that it ships with every Apple computer, and the technology is also available on other platforms, sush as Windows and Solaris. For instance, the iTunes music player relies on ZeroConf for discovering other iTunes instances running on the same network segment, allowing those instances to share playlists and music collections.

One of ZeroConf's designers, Stuart Cheshire, is a leading expert on DNS, and it is thus not surprising that ZeroConf extends key DNS concepts to support registering and discovering services. A pair of articles, extracted from a recent book on ZeroConf by Cheshire and Daniel Steinberg, discuss ZeroConf's three main components, Link-Local Addressing, Multicast DNS, and DNS Service Discovery (DNS-SD), and focus on registering and discovering services with the ZeroConf DNS-SD Java API.

As the article shows, registering a network service with ZeroConf is easy:

There are two steps you must take to register a service:
  1. Call DNSSD.register() using one of the two available signatures.
  2. Provide a class that implements the RegisterListener interface.
[...] The first step can be as simple as a single line of code:

DNSSDRegistration r = DNSSD.register("Moët & Chandon", "_example._tcp", 9099, this);

This advertises a service of type _example._tcp, which is listening on port 9099, with the instance name Moët & Chandon. [...] Service instance names can contain uppercase, lowercase, spaces, punctuation, accented characters, and even non-roman characters like Kanji.

And service discovery is similary easy:
To browse, you need to perform two steps similar to those you just used to register your service:
  1. Call DNSSD.browse() using one of the two available signatures.
  2. Provide a class that implements the BrowseListener interface
[...] To function as a BrowseListener, a class must implement operationFailed(), serviceFound(), and serviceLost() [...]: public void serviceFound(DNSSDService browser, int flags, int ifIndex, String name, String regType, String domain);
What do you think of ZeroConf's approach to dynamic networking?

Topic: Register and Discover Services with ZeroConf's Java API Previous Topic   Next Topic Topic: NetBeans Releases Jackpot

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use