Get Device IP with Bonjour

时光总嘲笑我的痴心妄想 提交于 2019-12-08 06:17:09

问题


I am using Java 6 update 14 for development and NetBeans 6.7. I am creating a sample client to detect particular type of service using Bonjour.

I face a certain challenge where I want to get the IP address of the device. But the ResolveListener.serviceResolved(...) function, provides only Hostname and Port. The FullName also does not contain IP information of the device. Is it possible to obtain the IP address of the device using Bonjour SDK? If yes, how?

Thanks.


回答1:


Use the standard Java InetAddress class to resolve the hostname to an IP address. ZeroConf (Bonjour being Apple's implementation) quite reasonably abstracts service-hosts by hostname.



来源:https://stackoverflow.com/questions/1243093/get-device-ip-with-bonjour

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!