如何在android中获取同一wifi网络中其他主机的IP地址?
我正在使用 Android 应用程序中的 wifi 打印机来打印任何文件。现在,如果我有打印机的 IP 地址,我就可以将文件发送到打印机。但我只有设备的 IP 地址。 那么我如何在android中的同一wifi网络中获取其他主机(设备、PC)的IP地址?
有人可以帮助我吗?
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要通过网络进行扫描以获取网络上的实时 IP。
为此,您需要获取 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.