以编程方式在桌面找到过USB绑定的IP地址 [英] Programmatically find the IP address of the desktop over USB tethering
问题描述
有没有办法找到台式机的IP地址连接的android手机USB绑定开启后?
Is there a way to find the IP address of the desktop machine connected the android phone after USB tethering is turned on?
安卓是否分配一个固定的IP地址到桌面?或者它分配一个动态地址(DHCP)?有没有在手机和计算机之间建立PPP连接?
Does android assign a fixed IP address to the desktop? Or does it assign a dynamic address (dhcp)? Is there a PPP connection created between the phone and machine?
推荐答案
通过USB绑定似乎所有的Android设备使用相同的静态地址,使用tcpdump的Android设备是192.168.42.129
With USB tethering it seems that all android devices use the same static addresses, the android device using tcpdump is 192.168.42.129
附加设备会得到相同的地址范围提供地址的DHCP。
The attached device will get a DHCP provided address in the same address range.
我听我的Android应用程序的端口,并有一个udev规则推dhclient的地址返回给该端口上我的应用程序。
I listen to a port on my android app and have a udev rule to push the dhclient address back to that port on my app.
这篇关于以编程方式在桌面找到过USB绑定的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!