public interface JmmDNS extends Closeable
Java Multihomed Multicast DNS
Uses an underlyingJmDNS
instance for each InetAddress
found on this computer.NetworkTopologyListener
).Note: This API is experimental and may change in the future please let us know what work and what does not work in your application.
Modifier and Type | Interface and Description |
---|---|
static class |
JmmDNS.Factory
JmmDNS.Factory enable the creation of new instance of JmmDNS.
|
Modifier and Type | Method and Description |
---|---|
void |
addNetworkTopologyListener(NetworkTopologyListener listener)
Listen to network changes.
|
void |
addServiceListener(String type,
ServiceListener listener)
Listen for services of a given type.
|
void |
addServiceTypeListener(ServiceTypeListener listener)
Listen for service types.
|
JmDNS[] |
getDNS()
Return a list of all the registered JmDNS instances
|
String[] |
getHostNames()
Return the list HostName associated with this JmmDNS instance.
|
InetAddress[] |
getInetAddresses()
Return the list of addresses of the interface to which this instance of JmmDNS is bound.
|
InetAddress[] |
getInterfaces()
Deprecated.
do not use this implementation yields unpredictable results use
getInetAddresses() |
String[] |
getNames()
Return the names of the JmDNS instances.
|
ServiceInfo[] |
getServiceInfos(String type,
String name)
Get service information.
|
ServiceInfo[] |
getServiceInfos(String type,
String name,
boolean persistent)
Get service information.
|
ServiceInfo[] |
getServiceInfos(String type,
String name,
boolean persistent,
long timeout)
Get service information.
|
ServiceInfo[] |
getServiceInfos(String type,
String name,
long timeout)
Get service information.
|
ServiceInfo[] |
list(String type)
Returns a list of service infos of the specified type.
|
ServiceInfo[] |
list(String type,
long timeout)
Returns a list of service infos of the specified type.
|
Map<String,ServiceInfo[]> |
listBySubtype(String type)
Returns a list of service infos of the specified type sorted by subtype.
|
Map<String,ServiceInfo[]> |
listBySubtype(String type,
long timeout)
Returns a list of service infos of the specified type sorted by subtype.
|
NetworkTopologyListener[] |
networkListeners()
Returns list of network change listeners
|
void |
registerService(ServiceInfo info)
Register a service.
|
void |
registerServiceType(String type)
Register a service type.
|
void |
removeNetworkTopologyListener(NetworkTopologyListener listener)
Remove listener for network changes.
|
void |
removeServiceListener(String type,
ServiceListener listener)
Remove listener for services of a given type.
|
void |
removeServiceTypeListener(ServiceTypeListener listener)
Remove listener for service types.
|
void |
requestServiceInfo(String type,
String name)
Request service information.
|
void |
requestServiceInfo(String type,
String name,
boolean persistent)
Request service information.
|
void |
requestServiceInfo(String type,
String name,
boolean persistent,
long timeout)
Request service information.
|
void |
requestServiceInfo(String type,
String name,
long timeout)
Request service information.
|
void |
unregisterAllServices()
Unregister all services.
|
void |
unregisterService(ServiceInfo info)
Unregister a service.
|
String[] getNames()
JmDNS.getName()
String[] getHostNames()
JmDNS.getHostName()
InetAddress[] getInetAddresses() throws IOException
IOException
JmDNS.getInetAddress()
@Deprecated InetAddress[] getInterfaces() throws IOException
getInetAddresses()
IOException
JmDNS.getInterface()
JmDNS[] getDNS()
ServiceInfo[] getServiceInfos(String type, String name)
type
- fully qualified service type, such as _http._tcp.local.
.name
- unqualified service name, such as foobar
.JmDNS.getServiceInfo(java.lang.String, java.lang.String)
ServiceInfo[] getServiceInfos(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.JmDNS.getServiceInfo(java.lang.String, java.lang.String, long)
ServiceInfo[] getServiceInfos(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.JmDNS.getServiceInfo(java.lang.String, java.lang.String, boolean)
ServiceInfo[] getServiceInfos(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.JmDNS.getServiceInfo(java.lang.String, java.lang.String, boolean, long)
void requestServiceInfo(String type, String name)
type
- full qualified service type, such as _http._tcp.local.
.name
- unqualified service name, such as foobar
.JmDNS.requestServiceInfo(java.lang.String, java.lang.String)
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.JmDNS.requestServiceInfo(java.lang.String, java.lang.String, boolean)
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 millisecondsJmDNS.requestServiceInfo(java.lang.String, java.lang.String, long)
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 millisecondsJmDNS.requestServiceInfo(java.lang.String, java.lang.String, boolean, long)
void addServiceTypeListener(ServiceTypeListener listener) throws IOException
listener
- listener for service typesIOException
JmDNS.addServiceTypeListener(javax.jmdns.ServiceTypeListener)
void removeServiceTypeListener(ServiceTypeListener listener)
listener
- listener for service typesJmDNS.removeServiceTypeListener(javax.jmdns.ServiceTypeListener)
void addServiceListener(String type, ServiceListener listener)
_http._tcp.local.
.type
- full qualified service type, such as _http._tcp.local.
.listener
- listener for service updatesJmDNS.addServiceListener(java.lang.String, javax.jmdns.ServiceListener)
void removeServiceListener(String type, ServiceListener listener)
type
- full qualified service type, such as _http._tcp.local.
.listener
- listener for service updatesJmDNS.removeServiceListener(java.lang.String, javax.jmdns.ServiceListener)
void registerService(ServiceInfo info) throws IOException
info
- service info to registerIOException
JmDNS.registerService(javax.jmdns.ServiceInfo)
void unregisterService(ServiceInfo info)
info
- service info to removeJmDNS.unregisterService(javax.jmdns.ServiceInfo)
void unregisterAllServices()
JmDNS.unregisterAllServices()
void registerServiceType(String type)
type
- full qualified service type, such as _http._tcp.local.
.JmDNS.registerServiceType(java.lang.String)
ServiceInfo[] list(String type)
type
- Service type name, such as _http._tcp.local.
.JmDNS.list(java.lang.String)
ServiceInfo[] list(String type, long timeout)
type
- Service type name, such as _http._tcp.local.
.timeout
- timeout in milliseconds. Typical timeout should be 6s.JmDNS.list(java.lang.String, long)
Map<String,ServiceInfo[]> listBySubtype(String type)
type
- Service type name, such as _http._tcp.local.
.JmDNS.listBySubtype(java.lang.String)
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.JmDNS.listBySubtype(java.lang.String, long)
void addNetworkTopologyListener(NetworkTopologyListener listener)
listener
- listener for network changesvoid removeNetworkTopologyListener(NetworkTopologyListener listener)
listener
- listener for network changesNetworkTopologyListener[] networkListeners()
Copyright © 2002–2017 JmDNS. All rights reserved.