Android NetworkInterface. NetworkInterface名称的含义是什么? [英] Android NetworkInterface. What are the meanings of names of NetworkInterface?
问题描述
我想获取当前设备的可用网络,所以我首先获取networkinterfaces列表:
I want to get available network of the current device, so I firstly get networkinterfaces list:
NetworkInterface.getNetworkInterfaces();
然后,迭代每个对象:
NetworkInterface intf = en.nextElement();
String name = intf.getName();
这是问题所在.返回值名称"的名称为:rmnet_data1,dymmy0,wlan0,rmnet_usb0,intf,lo,p2p0,sit0. (在我的设备上)我想知道它们的含义.
Here is the problem. The names of returned value of 'name' are: rmnet_data1, dymmy0, wlan0, rmnet_usb0, intf, lo, p2p0, sit0. (on my device) I want to know what are the meanings of them.
推荐答案
由于Android基于Linux,因此Linux网络接口命名模式适用于Android设备.
Since Android is based on Linux, Linux network interface naming patterns apply to Android devices.
有关* nix网络接口命名的一些资源
Here's some resources on *nix network interface naming
- a tour of classic Linux network interface names
- new predictable interface names
- a good StackOverflow question
总结:
lo
通常代表回送接口(localhost)
lo
usually stands for the loopback interface (localhost)
wlan
通常代表无线网络接口
wlan
usually stands for a wireless networking interface
rmnet
接口通常与 sit
接口与通过IPv4进行IPv6隧道关联
p2p
接口通常与对等连接相关联(也许您的Android设备的
p2p
interfaces are usually associated with peer-to-peer connections (perhaps your Android device's WiFi Direct support?)
dummy
接口为回送接口提供特殊别名
dummy
interfaces provide special aliases for the loopback interface
这篇关于Android NetworkInterface. NetworkInterface名称的含义是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!