Question

I am trying to use JmDNS to discover the services. I am able to discover the service using the Sample Code given at the

When I add a service listener and invoke the addServiceListener, it properly identifies the service. But, I have the same service running on more than one device. Now, I am wondering how I will be able to get the list of all the IP Address on which the service is running. I am only able to get the IP Address of one the devices.

And also what is the difference between JmDNS and JmmDNS?

Was it helpful?

Solution

See at the docs to learn what JmmDNS is: http://jmdns.sourceforge.net/apidocs/javax/jmdns/JmmDNS.html

To get all IP Addresses where the service is provided, you just need to add one listener for the service. It should be notified for every service available in the network.

So the method serviceAdded(ServiceEvent event) from the ServiceListener will be called multiple times. But you have to trigger that the service will be resolved and you have to actually save all IP addresses yourself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top