0

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?

4

1 回答 1

1

请参阅文档以了解 JmmDNS 是什么:http: //jmdns.sourceforge.net/apidocs/javax/jmdns/JmmDNS.html

要获取提供该服务的所有 IP 地址,您只需为该服务添加一个侦听器。网络中可用的每项服务都应通知它。

因此,ServiceListener 中的方法 serviceAdded(ServiceEvent event) 将被多次调用。但是您必须触发该服务将被解析,并且您必须自己实际保存所有 IP 地址。

于 2013-09-03T18:33:56.240 回答