Android NetworkInterface。 NetworkInterface名称的含义是什么?

时间:2015-11-17 01:46:13

标签: android network-interface

我想获得当前设备的可用网络,所以我首先获得网络接口列表:

NetworkInterface.getNetworkInterfaces();

然后,迭代每一个:

NetworkInterface intf = en.nextElement();
String name = intf.getName();

这是问题所在。 'name'的返回值名称为:rmnet_data1,dymmy0,wlan0,rmnet_usb0,intf,lo,p2p0,sit0。 (在我的设备上)我想知道它们的含义是什么。

2 个答案:

答案 0 :(得分:26)

由于Android基于Linux,因此Linux网络接口命名模式适用于Android设备。

这里有* nix网络接口命名的一些资源

总结:

lo通常代表环回接口(localhost)

wlan通常代表无线网络接口

rmnet接口通常与cellular connections and usb tethering

相关联

sit个接口与tunneling IPv6 over IPv4

相关联

p2p接口通常与点对点连接相关联(也许是您的Android设备WiFi Direct支持?)

dummy接口提供special aliases for the loopback interface

答案 1 :(得分:0)

当在 Android 设备上激活移动热点(接入点)时,可以找到

apswlan 接口(取决于 Android 发行版)。不过,它也可能与常规 wlan 界面相关联(在无法同时激活 WiFi 连接和移动热点的设备上观察到,例如 Galaxy Tab S2 上的 Android 9)。