专注应用,关注发展,开拓创新

<-------------------------------------------------------------------& 珍惜生命 . 善用时间 . 把握未来 . 创造价值。

BlogJava 首页 新随笔 联系 聚合 管理
  11 Posts :: 17 Stories :: 10 Comments :: 0 Trackbacks

#

import  java.net.*;
//...
 
System.out.println("\n+---------------------[ Network Cards ]----------------------+\n");
try{for(Enumeration list = NetworkInterface.getNetworkInterfaces(); list.hasMoreElements();)
{
NetworkInterface iFace = (NetworkInterface)list.nextElement();
System.out.println("Card:" + iFace.getDisplayName());
InetAddress adr;
for(Enumeration addresses = iFace.getInetAddresses(); addresses.hasMoreElements(); System.out.println(" -> " + adr.getHostAddress()))
adr = (InetAddress)addresses.nextElement();
 
}
 
}catch(SocketException se)
{
System.out.println("Failed discovering network cards!");
System.out.println("Error: " + se);
}
posted @ 2006-07-04 09:09 吴名居 阅读(286) | 评论 (0)编辑 收藏

仅列出标题
共2页: 上一页 1 2