How to get the list of IP addresses in a LAN?

穿精又带淫゛_ 提交于 2019-12-11 06:24:38

问题


My Android Phone is connected to a LAN.

There is a way in Java to get the list of LAN IPs?

I would like to get this list because my app has to connect to a SQL Server on a LAN Machine to syncronize some datas.

Could someone help me?


回答1:


You can try to launch a shell command from your Java application: nmap 192.168.1.*

But I haven't tryied!




回答2:


There isn't, but there are ways to advertise/locate a service without knowing the IP address. Look for zeroconf (what Apple calls bonjour). Microsoft has an alternative, UPNP.

Most apps seem to give up and simply ask the user to type in the IP address.



来源:https://stackoverflow.com/questions/7672153/how-to-get-the-list-of-ip-addresses-in-a-lan

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