Topic subject: Network Interface Adapter Info using Java APIs.
Posted: Thu Oct 16, 2008 7:17 pm
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2277 Location: Earth Has thanked: 39 time Have thanks: 61 time
* Project Name:
Network Interface Adapter Info using Java API * Programmer:Cipson * Type:Network * Technology:Java * IDE:Any * Description:Network Interface/Adapter Info using Java APIs.
Code:
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();}