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" |
mDNS implementation in Java.
Definition at line 20 of file JmDNS.java.
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.
.
type | full qualified service type, such as _http._tcp.local. . |
listener | listener 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.
listener | listener for service types |
IOException | if 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)
.
IOException | if 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)
.
addr | IP address to bind to. |
IOException | if 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)
.
name | name of the newly created JmDNS |
IOException | if 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:
net.mdns.interface
If name
parameter is null will use the hostname. The hostname is determined by the following algorithm:
JmDNS name
or computer
if null. '.'
replace them by '-'
.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.
addr | IP address to bind to. |
name | name of the newly created JmDNS |
IOException | if an exception occurs during the socket creation |
Definition at line 136 of file JmDNS.java.
abstract Delegate javax.jmdns.JmDNS.getDelegate | ( | ) | [pure virtual] |
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.
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.
IOException | if 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.
IOException | if there is an error in the underlying protocol, such as a TCP error. |
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.
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.
type | fully qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout in milliseconds. Typical timeout should be 5s. |
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.
type | fully qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout in milliseconds. Typical timeout should be 5s. |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
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.
type | Service type name, such as _http._tcp.local. . |
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.
type | Service type name, such as _http._tcp.local. . |
timeout | timeout in milliseconds. Typical timeout should be 6s. |
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.
type | Service type name, such as _http._tcp.local. . |
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.
type | Service type name, such as _http._tcp.local. . |
timeout | timeout in milliseconds. Typical timeout should be 6s. |
Implemented in javax.jmdns.impl.JmDNSImpl.
abstract void javax.jmdns.JmDNS.printServices | ( | ) | [pure virtual] |
List Services and serviceTypes. Debugging Only
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)}.
info | service info to register |
IOException | if 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.
type | full qualified service type, such as _http._tcp.local. . |
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.
type | full qualified service type, such as _http._tcp.local. . |
listener | listener for service updates |
Implemented in javax.jmdns.impl.JmDNSImpl.
abstract void javax.jmdns.JmDNS.removeServiceTypeListener | ( | ServiceTypeListener | listener | ) | [pure virtual] |
Remove listener for service types.
listener | listener 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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified 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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if 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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
timeout | timeout 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.
type | full qualified service type, such as _http._tcp.local. . |
name | unqualified service name, such as foobar . |
persistent | if true ServiceListener.resolveService will be called whenever new new information is received. |
timeout | timeout in milliseconds |
Implemented in javax.jmdns.impl.JmDNSImpl.
abstract Delegate javax.jmdns.JmDNS.setDelegate | ( | Delegate | value | ) | [pure virtual] |
Sets the instance delegate
value | new 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.
info | service info to remove |
Implemented in javax.jmdns.impl.JmDNSImpl.
final String javax.jmdns.JmDNS.VERSION = "3.4.2" [static] |
The version of JmDNS.
Definition at line 42 of file JmDNS.java.