Thu Oct 16, 2008 7:17 pm
import java.net.*;
import java.util.*;
public class NetWorkInfo
{
public static void main(String args[])
{
try{
NetworkInterface ntAdapter = null;
InetAddress inet = null;
System.out.println("Network Interface Informations");
Enumeration enum = NetworkInterface.getNetworkInterfaces();
while(enum.hasMoreElements())
{
ntAdapter = (NetworkInterface)enum.nextElement();
System.out.println("
Adapter Display Name :"+ntAdapter.getDisplayName());
System.out.println("Adapter Name : "+ntAdapter.getName());
Enumeration e = ntAdapter.getInetAddresses();
while(e.hasMoreElements())
{
inet = (InetAddress)e.nextElement();
System.out.println(" IP Address : "+inet.getHostAddress() );
}
}
}catch(Exception e){e.printStackTrace();}
}
}
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.