|
JmDNS 3.4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.jmdns.JmDNS
public abstract class JmDNS
mDNS implementation in Java.
Nested Class Summary | |
---|---|
static interface |
JmDNS.Delegate
|
Field Summary | |
---|---|
static String |
VERSION
The version of JmDNS. |
Constructor Summary | |
---|---|
JmDNS()
|
Method Summary | |
---|---|
abstract void |
addServiceListener(String type,
ServiceListener listener)
Listen for services of a given type. |
abstract void |
addServiceTypeListener(ServiceTypeListener listener)
Listen for service types. |
static JmDNS |
create()
Create an instance of JmDNS. |
static JmDNS |
create(InetAddress addr)
Create an instance of JmDNS and bind it to a specific network interface given its IP-address. |
static JmDNS |
create(InetAddress addr,
String name)
Create an instance of JmDNS and bind it to a specific network interface given its IP-address. |
static JmDNS |
create(String name)
Create an instance of JmDNS. |
abstract JmDNS.Delegate |
getDelegate()
Returns the instance delegate |
abstract String |
getHostName()
Return the HostName associated with this JmDNS instance. |
abstract InetAddress |
getInterface()
Return the address of the interface to which this instance of JmDNS is bound. |
abstract String |
getName()
Return the name of the JmDNS instance. |
abstract ServiceInfo |
getServiceInfo(String type,
String name)
Get service information. |
abstract ServiceInfo |
getServiceInfo(String type,
String name,
boolean persistent)
Get service information. |
abstract ServiceInfo |
getServiceInfo(String type,
String name,
boolean persistent,
long timeout)
Get service information. |
abstract ServiceInfo |
getServiceInfo(String type,
String name,
long timeout)
Get service information. |
abstract ServiceInfo[] |
list(String type)
Returns a list of service infos of the specified type. |
abstract ServiceInfo[] |
list(String type,
long timeout)
Returns a list of service infos of the specified type. |
abstract Map<String,ServiceInfo[]> |
listBySubtype(String type)
Returns a list of service infos of the specified type sorted by subtype. |
abstract Map<String,ServiceInfo[]> |
listBySubtype(String type,
long timeout)
Returns a list of service infos of the specified type sorted by subtype. |
abstract void |
printServices()
Deprecated. since 3.2.2 |
abstract void |
registerService(ServiceInfo info)
Register a service. |
abstract boolean |
registerServiceType(String type)
Register a service type. |
abstract void |
removeServiceListener(String type,
ServiceListener listener)
Remove listener for services of a given type. |
abstract void |
removeServiceTypeListener(ServiceTypeListener listener)
Remove listener for service types. |
abstract void |
requestServiceInfo(String type,
String name)
Request service information. |
abstract void |
requestServiceInfo(String type,
String name,
boolean persistent)
Request service information. |
abstract void |
requestServiceInfo(String type,
String name,
boolean persistent,
long timeout)
Request service information. |
abstract void |
requestServiceInfo(String type,
String name,
long timeout)
Request service information. |
abstract JmDNS.Delegate |
setDelegate(JmDNS.Delegate value)
Sets the instance delegate |
abstract void |
unregisterAllServices()
Unregister all services. |
abstract void |
unregisterService(ServiceInfo info)
Unregister a service. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.io.Closeable |
---|
close |
Field Detail |
---|
public static final String VERSION
Constructor Detail |
---|
public JmDNS()
Method Detail |
---|
public static JmDNS create() throws IOException
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 creationcreate(InetAddress, String)
public static JmDNS create(InetAddress addr) throws IOException
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 creationcreate(InetAddress, String)
public static JmDNS create(String name) throws IOException
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 creationcreate(InetAddress, String)
public static JmDNS create(InetAddress addr, String name) throws IOException
Create an instance of JmDNS and bind it to a specific network interface given its IP-address.
Ifaddr
parameter is null this method will try to resolve to a local IP address of the machine using a network discovery:
net.mdns.interface
NetworkTopologyDiscovery
to find a valid network interface and IP.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 creationpublic abstract String getName()
public abstract String getHostName()
public abstract InetAddress getInterface() throws IOException
IOException
- if there is an error in the underlying protocol, such as a TCP error.public abstract ServiceInfo getServiceInfo(String type, String name)
type
- fully qualified service type, such as _http._tcp.local.
.name
- unqualified service name, such as foobar
.
public abstract ServiceInfo getServiceInfo(String type, String name, long timeout)
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.
public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent)
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.
public abstract ServiceInfo getServiceInfo(String type, String name, boolean persistent, long timeout)
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.
public abstract void requestServiceInfo(String type, String name)
type
- full qualified service type, such as _http._tcp.local.
.name
- unqualified service name, such as foobar
.public abstract void requestServiceInfo(String type, String name, boolean persistent)
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.public abstract void requestServiceInfo(String type, String name, long timeout)
type
- full qualified service type, such as _http._tcp.local.
.name
- unqualified service name, such as foobar
.timeout
- timeout in millisecondspublic abstract void requestServiceInfo(String type, String name, boolean persistent, long timeout)
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 millisecondspublic abstract void addServiceTypeListener(ServiceTypeListener listener) throws IOException
listener
- listener for service types
IOException
- if there is an error in the underlying protocol, such as a TCP error.public abstract void removeServiceTypeListener(ServiceTypeListener listener)
listener
- listener for service typespublic abstract void addServiceListener(String type, ServiceListener listener)
_http._tcp.local.
.
type
- full qualified service type, such as _http._tcp.local.
.listener
- listener for service updatespublic abstract void removeServiceListener(String type, ServiceListener listener)
type
- full qualified service type, such as _http._tcp.local.
.listener
- listener for service updatespublic abstract void registerService(ServiceInfo info) throws IOException
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.public abstract void unregisterService(ServiceInfo info)
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 removepublic abstract void unregisterAllServices()
public abstract boolean registerServiceType(String 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.@Deprecated public abstract void printServices()
public abstract ServiceInfo[] list(String type)
type
- Service type name, such as _http._tcp.local.
.
public abstract ServiceInfo[] list(String type, long timeout)
type
- Service type name, such as _http._tcp.local.
.timeout
- timeout in milliseconds. Typical timeout should be 6s.
public abstract Map<String,ServiceInfo[]> listBySubtype(String type)
type
- Service type name, such as _http._tcp.local.
.
public abstract Map<String,ServiceInfo[]> listBySubtype(String type, long timeout)
type
- Service type name, such as _http._tcp.local.
.timeout
- timeout in milliseconds. Typical timeout should be 6s.
public abstract JmDNS.Delegate getDelegate()
public abstract JmDNS.Delegate setDelegate(JmDNS.Delegate value)
value
- new instance delegate
|
Last updated 2011-08-25 12:40 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |