[英]How to get Ip address of other devices connected to switch network via Wifi programmatically?
In my project I need to get the ip address of the two different network that is connected to the switch for example my device ip is 192.168.2.5 and my printer ip address is 10.1.7.5在我的项目中,我需要获取连接到交换机的两个不同网络的 IP 地址,例如我的设备 IP 是 192.168.2.5,我的打印机 IP 地址是 10.1.7.5
I need to detect the printer ip address from my devices programmatically in android.我需要在 android 中以编程方式从我的设备中检测打印机 IP 地址。
There are only 2 ways of solving your problem:只有两种方法可以解决您的问题:
1) Your printer must register it IPv4 address somewhere. 1) 您的打印机必须在某处注册 IPv4 地址。 For example, in dynamic DNS zone with a predefined name.
例如,在具有预定义名称的动态 DNS 区域中。 Then you can lookup this name there and get it IP addr.
然后你可以在那里查找这个名字并获得它的 IP 地址。
2) If your switch is smart enough (eg, is manageable one), You can login into it interface (ssh or web) and scan through MAC address table. 2) 如果您的交换机足够智能(例如,是可管理的),您可以登录它的界面(ssh 或 web)并扫描 MAC 地址表。 In this case you must know printer MAC to look for.
在这种情况下,您必须知道要查找的打印机 MAC。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.