Android NetworkInterface. NetworkInterface名称的含义是什么? [英] Android NetworkInterface. What are the meanings of names of NetworkInterface?

查看:100
本文介绍了Android NetworkInterface. 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆