时代Java,与您同行!
关注微信公众号,关注前沿技术,微信搜索:nowjava或时代Java,也可点击这里扫码关注
时代Java
首页
集册
文章
实例
项目
快讯
时代+
手册
下载
Jar查找
登录
注册
Java 网络接口概述
Java 网络接口概述
欢马劈雪
工程师 (已认证)
原创分享签约作者
发表于
实例源码
订阅
600
查看 / 运行 实例源码
network interface类表示网络接口。
实例源码:
源代码:
执行
执行中...
import java.net.InetAddress; import java.net.NetworkInterface; /** 时 代 J a v a 公 众 号 - nowjava.com **/ import java.util.Enumeration; public class Main { public static void main(String argv[]) throws Exception { Enumeration enumInterfaces = NetworkInterface.getNetworkInterfaces(); while (enumInterfaces.hasMoreElements()) { NetworkInterface net = (NetworkInterface) enumInterfaces.nextElement(); System.out.println("Network Interface Display Name: " + net.getDisplayName()); System.out.println(net.getDisplayName() + " is up and running ?" + net.isUp()); System.out.println(net.getDisplayName()+" Supports Multicast: "+net.supportsMulticast()); System.out.println(net.getDisplayName() + " Name: " + net.getName()); System.out.println(net.getDisplayName() + " Is Virtual: " + net.isVirtual()); System.out.println("IP addresses:"); Enumeration enumIP = net.getInetAddresses(); while (enumIP.hasMoreElements()) { /**代码未完, 请加载全部代码(NowJava.com).**/
编辑/阅读全部代码
执行结果:
Network Interface Display Name: Software Loopback Interface 1
Software Loopback Interface 1 is up and running ?true
Software Loopback Interface 1 Supports Multicast: true
Software Loopback Interface 1 Name: lo
Software Loopback Interface 1 Is Virtual: false
IP addresses:
IP address:/127.0.0.1
IP address:/0:0:0:0:0:0:0:1
Network Interface Display Name: WAN 微型端口(L2TP)
WAN 微型端口(L2TP) is up and running ?false
WAN 微型端口(L2TP) Supports Multicast: true
WAN 微型端口(L2TP) Name: net0
WAN 微型端口(L2TP) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(SSTP)
WAN 微型端口(SSTP) is up and running ?false
WAN 微型端口(SSTP) Supports Multicast: true
WAN 微型端口(SSTP) Name: net1
WAN 微型端口(SSTP) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN Miniport (IKEv2)
WAN Miniport (IKEv2) is up and running ?false
WAN Miniport (IKEv2) Supports Multicast: true
WAN Miniport (IKEv2) Name: net2
WAN Miniport (IKEv2) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(PPTP)
WAN 微型端口(PPTP) is up and running ?false
WAN 微型端口(PPTP) Supports Multicast: true
WAN 微型端口(PPTP) Name: net3
WAN 微型端口(PPTP) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(PPPOE)
WAN 微型端口(PPPOE) is up and running ?false
WAN 微型端口(PPPOE) Supports Multicast: true
WAN 微型端口(PPPOE) Name: ppp0
WAN 微型端口(PPPOE) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(IP)
WAN 微型端口(IP) is up and running ?false
WAN 微型端口(IP) Supports Multicast: true
WAN 微型端口(IP) Name: eth0
WAN 微型端口(IP) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(IPv6)
WAN 微型端口(IPv6) is up and running ?false
WAN 微型端口(IPv6) Supports Multicast: true
WAN 微型端口(IPv6) Name: eth1
WAN 微型端口(IPv6) Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(网络监视器)
WAN 微型端口(网络监视器) is up and running ?false
WAN 微型端口(网络监视器) Supports Multicast: true
WAN 微型端口(网络监视器) Name: eth2
WAN 微型端口(网络监视器) Is Virtual: false
IP addresses:
Network Interface Display Name: Microsoft 内核调试网络适配器
Microsoft 内核调试网络适配器 is up and running ?false
Microsoft 内核调试网络适配器 Supports Multicast: true
Microsoft 内核调试网络适配器 Name: eth3
Microsoft 内核调试网络适配器 Is Virtual: false
IP addresses:
Network Interface Display Name: RAS 同步适配器
RAS 同步适配器 is up and running ?false
RAS 同步适配器 Supports Multicast: true
RAS 同步适配器 Name: ppp1
RAS 同步适配器 Is Virtual: false
IP addresses:
Network Interface Display Name: Microsoft ISATAP Adapter
Microsoft ISATAP Adapter is up and running ?false
Microsoft ISATAP Adapter Supports Multicast: false
Microsoft ISATAP Adapter Name: net4
Microsoft ISATAP Adapter Is Virtual: false
IP addresses:
IP address:/fe80:0:0:0:0:5efe:ac15:d%net4
Network Interface Display Name: Teredo Tunneling Pseudo-Interface
Teredo Tunneling Pseudo-Interface is up and running ?false
Teredo Tunneling Pseudo-Interface Supports Multicast: true
Teredo Tunneling Pseudo-Interface Name: net5
Teredo Tunneling Pseudo-Interface Is Virtual: false
IP addresses:
Network Interface Display Name: Tencent VirtIO Ethernet Adapter
Tencent VirtIO Ethernet Adapter is up and running ?true
Tencent VirtIO Ethernet Adapter Supports Multicast: true
Tencent VirtIO Ethernet Adapter Name: eth4
Tencent VirtIO Ethernet Adapter Is Virtual: false
IP addresses:
IP address:/172.21.0.13
IP address:/fe80:0:0:0:c63:97ec:e700:972b%eth4
Network Interface Display Name: WAN 微型端口(IP)-WFP Native MAC Layer LightWeight Filter-0000
WAN 微型端口(IP)-WFP Native MAC Layer LightWeight Filter-0000 is up and running ?false
WAN 微型端口(IP)-WFP Native MAC Layer LightWeight Filter-0000 Supports Multicast: true
WAN 微型端口(IP)-WFP Native MAC Layer LightWeight Filter-0000 Name: eth5
WAN 微型端口(IP)-WFP Native MAC Layer LightWeight Filter-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(IP)-QoS Packet Scheduler-0000
WAN 微型端口(IP)-QoS Packet Scheduler-0000 is up and running ?false
WAN 微型端口(IP)-QoS Packet Scheduler-0000 Supports Multicast: true
WAN 微型端口(IP)-QoS Packet Scheduler-0000 Name: eth6
WAN 微型端口(IP)-QoS Packet Scheduler-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(IPv6)-WFP Native MAC Layer LightWeight Filter-0000
WAN 微型端口(IPv6)-WFP Native MAC Layer LightWeight Filter-0000 is up and running ?false
WAN 微型端口(IPv6)-WFP Native MAC Layer LightWeight Filter-0000 Supports Multicast: true
WAN 微型端口(IPv6)-WFP Native MAC Layer LightWeight Filter-0000 Name: eth7
WAN 微型端口(IPv6)-WFP Native MAC Layer LightWeight Filter-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(IPv6)-QoS Packet Scheduler-0000
WAN 微型端口(IPv6)-QoS Packet Scheduler-0000 is up and running ?false
WAN 微型端口(IPv6)-QoS Packet Scheduler-0000 Supports Multicast: true
WAN 微型端口(IPv6)-QoS Packet Scheduler-0000 Name: eth8
WAN 微型端口(IPv6)-QoS Packet Scheduler-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(网络监视器)-WFP Native MAC Layer LightWeight Filter-0000
WAN 微型端口(网络监视器)-WFP Native MAC Layer LightWeight Filter-0000 is up and running ?false
WAN 微型端口(网络监视器)-WFP Native MAC Layer LightWeight Filter-0000 Supports Multicast: true
WAN 微型端口(网络监视器)-WFP Native MAC Layer LightWeight Filter-0000 Name: eth9
WAN 微型端口(网络监视器)-WFP Native MAC Layer LightWeight Filter-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: WAN 微型端口(网络监视器)-QoS Packet Scheduler-0000
WAN 微型端口(网络监视器)-QoS Packet Scheduler-0000 is up and running ?false
WAN 微型端口(网络监视器)-QoS Packet Scheduler-0000 Supports Multicast: true
WAN 微型端口(网络监视器)-QoS Packet Scheduler-0000 Name: eth10
WAN 微型端口(网络监视器)-QoS Packet Scheduler-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: Tencent VirtIO Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000
Tencent VirtIO Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 is up and running ?false
Tencent VirtIO Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 Supports Multicast: true
Tencent VirtIO Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 Name: eth11
Tencent VirtIO Ethernet Adapter-WFP Native MAC Layer LightWeight Filter-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: Tencent VirtIO Ethernet Adapter-QoS Packet Scheduler-0000
Tencent VirtIO Ethernet Adapter-QoS Packet Scheduler-0000 is up and running ?false
Tencent VirtIO Ethernet Adapter-QoS Packet Scheduler-0000 Supports Multicast: true
Tencent VirtIO Ethernet Adapter-QoS Packet Scheduler-0000 Name: eth12
Tencent VirtIO Ethernet Adapter-QoS Packet Scheduler-0000 Is Virtual: false
IP addresses:
Network Interface Display Name: Tencent VirtIO Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
Tencent VirtIO Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 is up and running ?false
Tencent VirtIO Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 Supports Multicast: true
Tencent VirtIO Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 Name: eth13
Tencent VirtIO Ethernet Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000 Is Virtual: false
IP addresses:
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。
编辑于
2020-03-26 09:23:27
2020-03-26 09:23:27
分享
分享文章到朋友圈
分享文章到 QQ
分享文章到微博
复制文章链接到剪贴板
扫描二维码
关注时代Java
实例源码
实例源码
订阅
订阅专栏
Java 判断文件是否为文本文件及获取文件编码格式的方法实例
bootstrap 实例演示下拉菜单(Dropdown)插件用法。
HashSet、LinkedHashSet、TreeSet类存储元素的自动排序规则实例测试
html css 对于 body和h1设置的实例源码
Java 获取在线网页的源代码
Java HashSet添加、迭代输出字符串的完整示例代码
Java 随机整数数组
html css 设置背景图片定位并且不平铺
扫描二维码
关注时代Java
返回顶部