浏览 1087 次
该帖已经被评为隐藏帖
|
|
---|---|
作者 | 正文 |
发表时间:2009-09-07
最后修改:2009-09-07
package examples.a06; import java.net.NetworkInterface; import java.util.Enumeration; public class InterfaceLister { public static void main(String[] args) throws Exception { Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { NetworkInterface ni = (NetworkInterface) interfaces.nextElement(); System.out.println(ni); } } } 输出是: name:lo (MS TCP Loopback interface) index: 1 addresses: /127.0.0.1; name:eth0 (W-ibeda virtual adapter - ????ü??????ò?????) index: 2 addresses: name:eth1 (Broadcom NetLink (TM) Fast Ethernet - ????ü??????ò?????) index: 65540 addresses: /192.168.0.100; name:eth2 (Intel(R) Wireless WiFi Link 5100 - ????ü??????ò?????) index: 458757 addresses: name:ppp0 (WAN (PPP/SLIP) Interface) index: 786438 addresses: /117.88.171.252; 那位高手可以将乱码正确显示出来? 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |