NsLookUp pada Java
Program dan Penjelasannya :
Listing :
Output :
![]() |
NsLookUp.java |
Listing :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import java.net.*; public class NsLookup { public static void main(String args[]) { if (args.length == 0 ) { System.out.println( "Pemakaian: java NsLookup <hostname>" ); System.exit( 0 ); } String host = args[ 0 ]; InetAddress address = null ; try { address = InetAddress.getByName(host); } catch (UnknownHostException e) { System.out.println( "Unknown host" ); System.exit( 0 ); } byte [] ip = address.getAddress(); for ( int i= 0 ; i<ip .length= "" i= "" if = "" > 0 ) System.out.print( "." ); System.out.print((ip[i]) & 0xff ); } System.out.println(); } } |
Output :
Comments
Post a Comment