如何获得在同一WIFI网络在Android中其他主机的IP地址? [英] How to get IP adress of other hosts in same wifi network in android?

查看:134
本文介绍了如何获得在同一WIFI网络在Android中其他主机的IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用从我的Andr​​oid应用程序的wifi打印机打印的任何文件。现在,我能够发送文件到打印机,如果我有printer.But的IP地址,我只是有我的设备的IP地址。
所以,我怎么能得到同一wifi网络的其他主机(设备,个人电脑)的IP地址在android系统?

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 ?

任何人可以帮助我吗?

先谢谢了。

推荐答案

您需要执行扫描通过网络获取网络上的现场知识产权的。
这样做,你需要采取一个IP范围和尝试ping IP在一个循环。
范围可以从你自己的IP来获得。举例来说,如果你的IP是10.0.0.2那么很可能所有的IP的将在10.0.0.0骗10.0.0.255。
如果你要检查你需要问的一系列其他IP的。

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.

这篇关于如何获得在同一WIFI网络在Android中其他主机的IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆