How to get IP adress of other hosts in same wifi n

2019-06-11 05:17发布

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条回答
狗以群分
2楼-- · 2019-06-11 06:19

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.

查看更多
登录 后发表回答