Using jmdns you are listening to services. To subscribe, use the functions
jmdns = JmDNS.create(); jmdns.addServiceListener(String type, ServiceListener listener);
As soon as jmdns finds a service, a notification ServiceListener will be notified. The listener has three public functions:
serviceResolved(ServiceEvent event) serviceRemoved(ServiceEvent event) serviceAdded(ServiceEvent event)
with all ServiceEvent recipients. Now call event.getInfo().getHostAddresses() to get an array of all Host addresses.
If you want to allow the service, you must call
jmdns.requestServiceInfo(event.getType(), event.getName(), 1);
in the serviceAdded method.
Take a look at: Quick Start Guide
Raphclecle
source share