在Android的WiFi网络上获取可用的PC的IP地址 [英] Getting IP addresses of the PC's available on wifi network in android

查看:85
本文介绍了在Android的WiFi网络上获取可用的PC的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够通过Wi-fi在android和PC之间建立连接.但这是通过在android程序中对PC(服务器)的IP地址进行硬编码来完成的.但是我想以编程方式获取Wi-fi网络上可用的PC的IP地址.因此,请让我知道如何扫描网络上的PC并获取它们各自的IP地址.

I am able to establish connection between android and PC via Wi-fi. But this is done by hard coding the the IP address of the PC (server) in the android program. But I wanted to get IP addresses of the PC's available on the Wi-fi network programmatically. So please let me know how to scan for PC's on the network and get their respective IP address.

推荐答案

您是否可以在服务器侦听并响应的UDP数据包上组播包含服务器IP地址的UDP数据包,以便进行设置连接吗?

can you not multicast a UDP packet on the network which the server listens for and responds to with a packet containing the ip address of the server in order to set up the connection?

您应该能够找到有关该主题的帮助,并在此处 此处

You should be able to find help on that topic, with some options here here and here

这篇关于在Android的WiFi网络上获取可用的PC的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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