java/etc
Domain name to ip address
짱가쟁이
2012. 5. 15. 14:50
DNS 서버로 IP address 를 조회해서 출력하는 듯.
InetAddress inetAddress = InetAddress.getByName("www.google.co.kr");
System.out.println(inetAddress);
System.out.println(inetAddress.getCanonicalHostName());
System.out.println(inetAddress.getHostName());
System.out.println(inetAddress.getHostAddress());
결과
www.google.co.kr/74.125.71.94
hx-in-f94.1e100.net
www.google.co.kr
74.125.71.94