All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends
Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes
javax.jmdns.JmDNS Class Reference
Inheritance diagram for javax.jmdns.JmDNS:
Inheritance graph
[legend]

List of all members.

Classes

interface  Delegate

Public Member Functions

abstract void addServiceListener (String type, ServiceListener listener)
abstract void addServiceTypeListener (ServiceTypeListener listener) throws IOException
abstract Delegate getDelegate ()
abstract String getHostName ()
abstract InetAddress getInetAddress () throws IOException
abstract InetAddress getInterface () throws IOException
abstract String getName ()
abstract ServiceInfo getServiceInfo (String type, String name)
abstract ServiceInfo getServiceInfo (String type, String name, long timeout)
abstract ServiceInfo getServiceInfo (String type, String name, boolean persistent)
abstract ServiceInfo getServiceInfo (String type, String name, boolean persistent, long timeout)
abstract ServiceInfo[] list (String type)
abstract ServiceInfo[] list (String type, long timeout)
abstract Map< String,
ServiceInfo[]> 
listBySubtype (String type)
abstract Map< String,
ServiceInfo[]> 
listBySubtype (String type, long timeout)
abstract void printServices ()
abstract void registerService (ServiceInfo info) throws IOException
abstract boolean registerServiceType (String type)
abstract void removeServiceListener (String type, ServiceListener listener)
abstract void removeServiceTypeListener (ServiceTypeListener listener)
abstract void requestServiceInfo (String type, String name)
abstract void requestServiceInfo (String type, String name, boolean persistent)
abstract void requestServiceInfo (String type, String name, long timeout)
abstract void requestServiceInfo (String type, String name, boolean persistent, long timeout)
abstract Delegate setDelegate (Delegate value)
abstract void unregisterAllServices ()
abstract void unregisterService (ServiceInfo info)

Static Public Member Functions

static JmDNS create () throws IOException
static JmDNS create (final InetAddress addr) throws IOException
static JmDNS create (final String name) throws IOException
static JmDNS create (final InetAddress addr, final String name) throws IOException

Static Public Attributes

static final String VERSION = "3.4.2"

Detailed Description

mDNS implementation in Java.

Author:
Arthur van Hoff, Rick Blair, Jeff Sonstein, Werner Randelshofer, Pierre Frisch, Scott Lewis, Scott Cytacki

Definition at line 20 of file JmDNS.java.


Member Function Documentation

abstract void javax.jmdns.JmDNS.addServiceListener ( String  type,
ServiceListener  listener 
) [pure virtual]

Listen for services of a given type. The type has to be a fully qualified type name such as _http._tcp.local..

Parameters:
typefull qualified service type, such as _http._tcp.local..
listenerlistener for service updates

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.addServiceTypeListener ( ServiceTypeListener  listener) throws IOException [pure virtual]

Listen for service types.

Parameters:
listenerlistener for service types
Exceptions:
IOExceptionif there is an error in the underlying protocol, such as a TCP error.

Implemented in javax.jmdns.impl.JmDNSImpl.

static JmDNS javax.jmdns.JmDNS.create ( ) throws IOException [inline, static]

Create an instance of JmDNS.

Note: This is a convenience method. The preferred constructor is create(InetAddress, String).
Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.
This call is equivalent to create(null, null).

See also:
#create(InetAddress, String)
Returns:
jmDNS instance
Exceptions:
IOExceptionif an exception occurs during the socket creation

Definition at line 59 of file JmDNS.java.

static JmDNS javax.jmdns.JmDNS.create ( final InetAddress  addr) throws IOException [inline, static]

Create an instance of JmDNS and bind it to a specific network interface given its IP-address.

Note: This is a convenience method. The preferred constructor is create(InetAddress, String).
Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.
This call is equivalent to create(addr, null).

See also:
#create(InetAddress, String)
Parameters:
addrIP address to bind to.
Returns:
jmDNS instance
Exceptions:
IOExceptionif an exception occurs during the socket creation

Definition at line 80 of file JmDNS.java.

static JmDNS javax.jmdns.JmDNS.create ( final String  name) throws IOException [inline, static]

Create an instance of JmDNS.

Note: This is a convenience method. The preferred constructor is create(InetAddress, String).
Check that your platform correctly handle the default localhost IP address and the local hostname. In doubt use the explicit constructor.
This call is equivalent to create(null, name).

See also:
#create(InetAddress, String)
Parameters:
namename of the newly created JmDNS
Returns:
jmDNS instance
Exceptions:
IOExceptionif an exception occurs during the socket creation

Definition at line 101 of file JmDNS.java.

static JmDNS javax.jmdns.JmDNS.create ( final InetAddress  addr,
final String  name 
) throws IOException [inline, static]

Create an instance of JmDNS and bind it to a specific network interface given its IP-address. If addr parameter is null this method will try to resolve to a local IP address of the machine using a network discovery:

  1. Check the system property net.mdns.interface
  2. Check the JVM local host
  3. Use the NetworkTopologyDiscovery to find a valid network interface and IP.
  4. In the last resort bind to the loopback address. This is non functional in most cases.

If name parameter is null will use the hostname. The hostname is determined by the following algorithm:

  1. Get the hostname from the InetAdress obtained before.
  2. If the hostname is a reverse lookup default to JmDNS name or computer if null.
  3. If the name contains '.' replace them by '-'
  4. Add .local. at the end of the name.

Note: If you need to use a custom NetworkTopologyDiscovery it must be setup before any call to this method. This is done by setting up a NetworkTopologyDiscovery.Factory.ClassDelegate and installing it using NetworkTopologyDiscovery.Factory#setClassDelegate(NetworkTopologyDiscovery.Factory.ClassDelegate). This must be done before creating a JmDNS or JmmDNS instance.

Parameters:
addrIP address to bind to.
namename of the newly created JmDNS
Returns:
jmDNS instance
Exceptions:
IOExceptionif an exception occurs during the socket creation

Definition at line 136 of file JmDNS.java.

abstract Delegate javax.jmdns.JmDNS.getDelegate ( ) [pure virtual]

Returns the instance delegate

Returns:
instance delegate

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract String javax.jmdns.JmDNS.getHostName ( ) [pure virtual]

Return the HostName associated with this JmDNS instance. Note: May not be the same as what started. The host name is subject to negotiation.

Returns:
Host name

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract InetAddress javax.jmdns.JmDNS.getInetAddress ( ) throws IOException [pure virtual]

Return the address of the interface to which this instance of JmDNS is bound.

Returns:
Internet Address
Exceptions:
IOExceptionif there is an error in the underlying protocol, such as a TCP error.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract InetAddress javax.jmdns.JmDNS.getInterface ( ) throws IOException [pure virtual]

Return the address of the interface to which this instance of JmDNS is bound.

Returns:
Internet Address
Exceptions:
IOExceptionif there is an error in the underlying protocol, such as a TCP error.
Deprecated:
do not use this implementation yields unpredictable results use getInetAddress()

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract String javax.jmdns.JmDNS.getName ( ) [pure virtual]

Return the name of the JmDNS instance. This is an arbitrary string that is useful for distinguishing instances.

Returns:
name of the JmDNS

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo javax.jmdns.JmDNS.getServiceInfo ( String  type,
String  name 
) [pure virtual]

Get service information. If the information is not cached, the method will block until updated information is received.

Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.

Parameters:
typefully qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
Returns:
null if the service information cannot be obtained

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo javax.jmdns.JmDNS.getServiceInfo ( String  type,
String  name,
long  timeout 
) [pure virtual]

Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.

Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout in milliseconds. Typical timeout should be 5s.
Returns:
null if the service information cannot be obtained

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo javax.jmdns.JmDNS.getServiceInfo ( String  type,
String  name,
boolean  persistent 
) [pure virtual]

Get service information. If the information is not cached, the method will block until updated information is received.

Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.

Parameters:
typefully qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
Returns:
null if the service information cannot be obtained

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo javax.jmdns.JmDNS.getServiceInfo ( String  type,
String  name,
boolean  persistent,
long  timeout 
) [pure virtual]

Get service information. If the information is not cached, the method will block for the given timeout until updated information is received.

Usage note: If you call this method from the AWT event dispatcher thread, use a small timeout, or you will make the user interface unresponsive.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout in milliseconds. Typical timeout should be 5s.
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
Returns:
null if the service information cannot be obtained

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo [] javax.jmdns.JmDNS.list ( String  type) [pure virtual]

Returns a list of service infos of the specified type.

Parameters:
typeService type name, such as _http._tcp.local..
Returns:
An array of service instance.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract ServiceInfo [] javax.jmdns.JmDNS.list ( String  type,
long  timeout 
) [pure virtual]

Returns a list of service infos of the specified type.

Parameters:
typeService type name, such as _http._tcp.local..
timeouttimeout in milliseconds. Typical timeout should be 6s.
Returns:
An array of service instance.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract Map<String, ServiceInfo[]> javax.jmdns.JmDNS.listBySubtype ( String  type) [pure virtual]

Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.

Parameters:
typeService type name, such as _http._tcp.local..
Returns:
A dictionary of service info by subtypes.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract Map<String, ServiceInfo[]> javax.jmdns.JmDNS.listBySubtype ( String  type,
long  timeout 
) [pure virtual]

Returns a list of service infos of the specified type sorted by subtype. Any service that do not register a subtype is listed in the empty subtype section.

Parameters:
typeService type name, such as _http._tcp.local..
timeouttimeout in milliseconds. Typical timeout should be 6s.
Returns:
A dictionary of service info by subtypes.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.printServices ( ) [pure virtual]

List Services and serviceTypes. Debugging Only

Deprecated:
since 3.2.2

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.registerService ( ServiceInfo  info) throws IOException [pure virtual]

Register a service. The service is registered for access by other jmdns clients. The name of the service may be changed to make it unique.
Note that the given

 ServiceInfo 

is bound to this

 JmDNS 

instance, and should not be reused for any other registerService(ServiceInfo)}.

Parameters:
infoservice info to register
Exceptions:
IOExceptionif there is an error in the underlying protocol, such as a TCP error.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract boolean javax.jmdns.JmDNS.registerServiceType ( String  type) [pure virtual]

Register a service type. If this service type was not already known, all service listeners will be notified of the new service type.

Service types are automatically registered as they are discovered.

Parameters:
typefull qualified service type, such as _http._tcp.local..
Returns:
true if the type or subtype was added, false if the type was already registered.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.removeServiceListener ( String  type,
ServiceListener  listener 
) [pure virtual]

Remove listener for services of a given type.

Parameters:
typefull qualified service type, such as _http._tcp.local..
listenerlistener for service updates

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.removeServiceTypeListener ( ServiceTypeListener  listener) [pure virtual]

Remove listener for service types.

Parameters:
listenerlistener for service types

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.requestServiceInfo ( String  type,
String  name 
) [pure virtual]

Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.requestServiceInfo ( String  type,
String  name,
boolean  persistent 
) [pure virtual]

Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

Usage note: Do not call this method from the AWT event dispatcher thread. You will make the user interface unresponsive.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif true ServiceListener.resolveService will be called whenever new new information is received.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.requestServiceInfo ( String  type,
String  name,
long  timeout 
) [pure virtual]

Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
timeouttimeout in milliseconds

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.requestServiceInfo ( String  type,
String  name,
boolean  persistent,
long  timeout 
) [pure virtual]

Request service information. The information about the service is requested and the ServiceListener.resolveService method is called as soon as it is available.

Parameters:
typefull qualified service type, such as _http._tcp.local. .
nameunqualified service name, such as foobar .
persistentif true ServiceListener.resolveService will be called whenever new new information is received.
timeouttimeout in milliseconds

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract Delegate javax.jmdns.JmDNS.setDelegate ( Delegate  value) [pure virtual]

Sets the instance delegate

Parameters:
valuenew instance delegate
Returns:
previous instance delegate

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.unregisterAllServices ( ) [pure virtual]

Unregister all services.

Implemented in javax.jmdns.impl.JmDNSImpl.

abstract void javax.jmdns.JmDNS.unregisterService ( ServiceInfo  info) [pure virtual]

Unregister a service. The service should have been registered.

Note: Unregistered services will not disappear form the list of services immediately. According to the specification, when unregistering services we send goodbye packets and then wait 1s before purging the cache.
This is support for shared records that can be rescued by some other cooperation DNS.

 Clients receiving a Multicast DNS Response with a TTL of zero SHOULD NOT immediately delete the record from the cache, but instead record a TTL of 1 and then delete the record one second later.
 
Parameters:
infoservice info to remove

Implemented in javax.jmdns.impl.JmDNSImpl.


Member Data Documentation

final String javax.jmdns.JmDNS.VERSION = "3.4.2" [static]

The version of JmDNS.

Definition at line 42 of file JmDNS.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


zeroconf_jmdns
Author(s): Daniel Stonier
autogenerated on Tue Nov 6 2012 13:08:26