javax.jmdns.impl

Class JmDNSImpl


public class JmDNSImpl
extends JmDNS

mDNS implementation in Java.

Field Summary

Fields inherited from class javax.jmdns.JmDNS

VERSION

Constructor Summary

JmDNSImpl()
Create an instance of JmDNS.
JmDNSImpl(InetAddress addr)
Create an instance of JmDNS and bind it to a specific network interface given its IP-address.

Method Summary

DNSOutgoing
addAnswer(DNSIncoming in, InetAddress addr, int port, DNSOutgoing out, DNSRecord rec)
Add an answer to a question.
void
addListener(javax.jmdns.impl.DNSListener listener, DNSQuestion question)
Add a listener for a question.
void
addServiceListener(String type, ServiceListener listener)
void
addServiceTypeListener(ServiceTypeListener listener)
void
advanceState()
Sets the state and notifies all objects that wait on JmDNS.
void
close()
DNSCache
getCache()
Return the DNSCache associated with the cache variable
InetAddress
getGroup()
String
getHostName()
InetAddress
getInterface()
Object
getIoLock()
long
getLastThrottleIncrement()
HostInfo
getLocalHost()
DNSIncoming
getPlannedAnswer()
static Random
getRandom()
ServiceInfo
getServiceInfo(String type, String name)
ServiceInfo
getServiceInfo(String type, String name, int timeout)
Map
getServiceTypes()
Map
getServices()
MulticastSocket
getSocket()
DNSState
getState()
Returns the current state of this info.
TimerTask
getTask()
int
getThrottle()
boolean
isClosed()
ServiceInfo[]
list(String type)
void
printServices()
void
recover()
Recover jmdns when there is an error.
void
registerService(ServiceInfo infoAbstract)
void
registerServiceType(String type)
void
removeListener(javax.jmdns.impl.DNSListener listener)
Remove a listener from all outstanding questions.
void
removeServiceListener(String type, ServiceListener listener)
void
removeServiceTypeListener(ServiceTypeListener listener)
void
requestServiceInfo(String type, String name)
void
requestServiceInfo(String type, String name, int timeout)
void
schedule(TimerTask task, int delay)
void
send(DNSOutgoing out)
Send an outgoing multicast DNS message.
void
setClosed(boolean closed)
void
setIoLock(Object ioLock)
void
setLastThrottleIncrement(long lastThrottleIncrement)
void
setPlannedAnswer(DNSIncoming plannedAnswer)
void
setState(DNSState state)
void
setTask(TimerTask task)
void
setThrottle(int throttle)
void
startAnnouncer()
void
startRenewer()
String
toString()
void
unregisterAllServices()
void
unregisterService(ServiceInfo infoAbstract)
void
updateRecord(long now, DNSRecord rec)
Notify all listeners that a record was updated.

Methods inherited from class javax.jmdns.JmDNS

addServiceListener, addServiceTypeListener, close, create, create, getHostName, getInterface, getServiceInfo, getServiceInfo, list, printServices, registerService, registerServiceType, removeServiceListener, removeServiceTypeListener, requestServiceInfo, requestServiceInfo, unregisterAllServices, unregisterService

Constructor Details

JmDNSImpl

public JmDNSImpl()
            throws IOException
Create an instance of JmDNS.

JmDNSImpl

public JmDNSImpl(InetAddress addr)
            throws IOException
Create an instance of JmDNS and bind it to a specific network interface given its IP-address.

Method Details

addAnswer

public DNSOutgoing addAnswer(DNSIncoming in,
                             InetAddress addr,
                             int port,
                             DNSOutgoing out,
                             DNSRecord rec)
            throws IOException
Add an answer to a question. Deal with the case when the outgoing packet overflows

addListener

public void addListener(javax.jmdns.impl.DNSListener listener,
                        DNSQuestion question)
Add a listener for a question. The listener will receive updates of answers to the question as they arrive, or from the cache if they are already available.

addServiceListener

public void addServiceListener(String type,
                               ServiceListener listener)
Overrides:
addServiceListener in interface JmDNS
See Also:
javax.jmdns.JmDNS.addServiceListener(java.lang.String, javax.jmdns.ServiceListener)

addServiceTypeListener

public void addServiceTypeListener(ServiceTypeListener listener)
            throws IOException
Overrides:
addServiceTypeListener in interface JmDNS

advanceState

public void advanceState()
Sets the state and notifies all objects that wait on JmDNS.

close

public void close()
Overrides:
close in interface JmDNS
See Also:
JmDNS.close()

getCache

public DNSCache getCache()
Return the DNSCache associated with the cache variable

getGroup

public InetAddress getGroup()

getHostName

public String getHostName()
Overrides:
getHostName in interface JmDNS

getInterface

public InetAddress getInterface()
            throws IOException
Overrides:
getInterface in interface JmDNS

getIoLock

public Object getIoLock()

getLastThrottleIncrement

public long getLastThrottleIncrement()

getLocalHost

public HostInfo getLocalHost()

getPlannedAnswer

public DNSIncoming getPlannedAnswer()

getRandom

public static Random getRandom()

getServiceInfo

public ServiceInfo getServiceInfo(String type,
                                  String name)
Overrides:
getServiceInfo in interface JmDNS
See Also:
javax.jmdns.JmDNS.getServiceInfo(java.lang.String, java.lang.String)

getServiceInfo

public ServiceInfo getServiceInfo(String type,
                                  String name,
                                  int timeout)
Overrides:
getServiceInfo in interface JmDNS
See Also:
javax.jmdns.JmDNS.getServiceInfo(java.lang.String, java.lang.String, int)

getServiceTypes

public Map getServiceTypes()

getServices

public Map getServices()

getSocket

public MulticastSocket getSocket()

getState

public DNSState getState()
Returns the current state of this info.

getTask

public TimerTask getTask()

getThrottle

public int getThrottle()

isClosed

public boolean isClosed()

list

public ServiceInfo[] list(String type)
Overrides:
list in interface JmDNS
See Also:
javax.jmdns.JmDNS.list(java.lang.String)

printServices

public void printServices()
Overrides:
printServices in interface JmDNS

recover

public void recover()
Recover jmdns when there is an error.

registerService

public void registerService(ServiceInfo infoAbstract)
            throws IOException
Overrides:
registerService in interface JmDNS

registerServiceType

public void registerServiceType(String type)
Overrides:
registerServiceType in interface JmDNS
See Also:
javax.jmdns.JmDNS.registerServiceType(java.lang.String)

removeListener

public void removeListener(javax.jmdns.impl.DNSListener listener)
Remove a listener from all outstanding questions. The listener will no longer receive any updates.

removeServiceListener

public void removeServiceListener(String type,
                                  ServiceListener listener)
Overrides:
removeServiceListener in interface JmDNS
See Also:
javax.jmdns.JmDNS.removeServiceListener(java.lang.String, javax.jmdns.ServiceListener)

removeServiceTypeListener

public void removeServiceTypeListener(ServiceTypeListener listener)
Overrides:
removeServiceTypeListener in interface JmDNS
See Also:
javax.jmdns.JmDNS.removeServiceTypeListener(javax.jmdns. ServiceTypeListener)

requestServiceInfo

public void requestServiceInfo(String type,
                               String name)
Overrides:
requestServiceInfo in interface JmDNS
See Also:
javax.jmdns.JmDNS.requestServiceInfo(java.lang.String, java.lang.String)

requestServiceInfo

public void requestServiceInfo(String type,
                               String name,
                               int timeout)
Overrides:
requestServiceInfo in interface JmDNS
See Also:
javax.jmdns.JmDNS.requestServiceInfo(java.lang.String, java.lang.String, int)

schedule

public void schedule(TimerTask task,
                     int delay)

send

public void send(DNSOutgoing out)
            throws IOException
Send an outgoing multicast DNS message.

setClosed

public void setClosed(boolean closed)

setIoLock

public void setIoLock(Object ioLock)

setLastThrottleIncrement

public void setLastThrottleIncrement(long lastThrottleIncrement)

setPlannedAnswer

public void setPlannedAnswer(DNSIncoming plannedAnswer)

setState

public void setState(DNSState state)

setTask

public void setTask(TimerTask task)

setThrottle

public void setThrottle(int throttle)

startAnnouncer

public void startAnnouncer()

startRenewer

public void startRenewer()

toString

public String toString()

unregisterAllServices

public void unregisterAllServices()
Overrides:
unregisterAllServices in interface JmDNS

unregisterService

public void unregisterService(ServiceInfo infoAbstract)
Overrides:
unregisterService in interface JmDNS

updateRecord

public void updateRecord(long now,
                         DNSRecord rec)
Notify all listeners that a record was updated.