Displaying Source Code(s)
|
|
Network Interface/Adapter Info using Java APIs.
--------------------------------------------------------------------------------
Description : Network Interface/Adapter Info using Java APIs.
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();}
} |
|
|