'InetAddress Test'에 해당되는 글 1건

  1. 2016.12.23 InetAddress Test

import java.net.InetAddress;


public class InetAddressTest {


public InetAddressTest() {

try{

//내컴퓨터의 객체 생성

InetAddress ia1 = InetAddress.getLocalHost();

System.out.println("ia1(address) = "+ia1.getHostAddress());

System.out.println("ia1(name) = "+ia1.getHostName());

//

InetAddress ia2 = InetAddress.getByName("www.bycho.kr");

System.out.println("ia2(address) = "+ia2.getHostAddress());

System.out.println("ia2(name) = "+ia2.getHostName());

InetAddress ia3 = InetAddress.getByName("175.126.170.70");

System.out.println("ia3(address); = "+ia3.getHostAddress());

System.out.println("ia3(name); = "+ia3.getHostName());

InetAddress ia4[] = InetAddress.getAllByName("www.naver.com");

for(InetAddress ia:ia4){

System.out.println("ia4 = "+ia.getHostAddress());

}

}catch(Exception e){}

}


public static void main(String[] args) {

new InetAddressTest();


}


}



'응용 SoftWare > JAVA' 카테고리의 다른 글

[예제] Source View  (0) 2016.12.23
URL Test  (0) 2016.12.23
Text Edit  (0) 2016.12.23
Thread Test 2  (0) 2016.12.23
Thread Test 1  (0) 2016.12.23
Posted by Hyun CHO
,