Android NetworkInterface. What are the meanings of names of NetworkInterface?

狂风中的少年 提交于 2019-12-03 07:40:32

问题


I want to get available network of the current device, so I firstly get networkinterfaces list:

NetworkInterface.getNetworkInterfaces();

Then, iterate every one:

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

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.


回答1:


Since Android is based on Linux, Linux network interface naming patterns apply to Android devices.

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

To summarize:

lo usually stands for the loopback interface (localhost)

wlan usually stands for a wireless networking interface

rmnet interfaces are usually associated with cellular connections and usb tethering

sit interfaces are associated with tunneling IPv6 over IPv4

p2p interfaces are usually associated with peer-to-peer connections (perhaps your Android device's WiFi Direct support?)

dummy interfaces provide special aliases for the loopback interface



来源:https://stackoverflow.com/questions/33747787/android-networkinterface-what-are-the-meanings-of-names-of-networkinterface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!