How to get IP adress of other hosts in same wifi network in android?

左心房为你撑大大i 提交于 2019-12-08 12:25:04

问题


I am using wifi printer from my android application to print any file. Now i am able to send file to printer if i have IP address of printer.But i am having my device's IP address only . SO how can i get IP adress of other hosts(devices,PCs) in same wifi network in android ?

Can anybody help me ?

Thanks in advance.


回答1:


You need to implement scanning over the network for obtaining live ip's on your network. For doing this you need to take a ip range and try to ping the ip in a loop. The range can be obtained from your own ip. For instance if your ip is 10.0.0.2 then probably all the ip's will lie in 10.0.0.0 to 10.0.0.255. In case you want to check for other ip's you need to ask for range.



来源:https://stackoverflow.com/questions/8264907/how-to-get-ip-adress-of-other-hosts-in-same-wifi-network-in-android

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