Microsoft Visual J++. Java


InetAddressDemo - 2


(0xff & (int)iaLocalIP[2]) + "." +

(0xff & (int)iaLocalIP[3]));

 

// IP ,

//

System.out.println("Local host IP address: " +

iaLocal.toString());

 

// ,

//

System.out.println("Enter remote host name...");

System.in.read(bKbdInput);

sIn = new String(bKbdInput, 0);

 

// ,

StringTokenizer st;

st = new StringTokenizer(sIn, "\r\n");

str = new String((String)st.nextElement());

 

// IP,

// ,

iaRemoteAll = InetAddress.getAllByName(str);

 

//

for(int i = 0; i < iaRemoteAll.length; i++)

{

System.out.println("Remote host IP address: " +

iaRemoteAll[i].toString());

}

 

System.out.println("Press <Enter> to terminate...");

System.in.read(bKbdInput);

}

catch(Exception ioe)

{

System.out.println(ioe.toString());

}

}

}