336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
package InetAddress;

import java.io.IOException;
import java.net.InetAddress;

public class isReachable {
    public static void main(String[] args)throws IOException{
        try {
            int timeout=2000;
            InetAddress[] addresses=InetAddress.getAllByName("www.google.com");
            for(InetAddress address : addresses){
                if(address.isReachable(timeout))
                    System.out.printf("%s is reachable%n",address);
                else
                    System.out.printf("%s could not be contacted%n",address);
            }
        } catch (Exception e) {
                System.out.printf("Unknown host : %s%n","www.google.com");
        }
    }
}


'Java' 카테고리의 다른 글

URL : getAuthority()  (0) 2015.01.25
new URL(String spec) throws MalformedURLException  (0) 2015.01.25
InetAddress : getLocalHost()  (0) 2015.01.25
InetAddress : getHostName()  (0) 2015.01.25
InetAddress : getHostAddress()  (0) 2015.01.25
Posted by af334