import java.io.*; import java.net.*; public class MultiCard { String hostName; InetAddress[] myInetAddresses; public MultiCard() { try { System.out.println( "Client Begin" ); getInetAddresses(); // Display Host Information and InetAddresses System.out.println( "\tHostname: " + hostName ); for ( int x = 0; x < myInetAddresses.length; x++ ) { System.out.println( "\t Address: " + myInetAddresses[x] ); } } catch ( UnknownHostException uhe ) { System.out.println( uhe ); return; } } private void getInetAddresses( ) throws UnknownHostException { // STEP 1: Get the Hostname hostName = InetAddress.getLocalHost().getHostName(); System.out.println( InetAddress.getLocalHost() ); // STEP 2: Get All the InetAddress-es associated with this host myInetAddresses = InetAddress.getAllByName( hostName ); } public static void main( String args[] ) { MultiCard app = new MultiCard(); } }