package com.bocloud.ims.service.utils;

import java.net.InetAddress;

/**
 * 测试ip地址是是不是能ping通
 * 
 * @author lkx007
 *
 */
public class PingUtils {

    public static boolean connect(String ip) {
        boolean isReachable;
        try {
            InetAddress address = InetAddress.getByName(ip);
            // 5秒超时时间
            int timeout = 5000;
            isReachable = address.isReachable(timeout);
        } catch (Exception e) {
            isReachable = false;
        }
        return isReachable;
    }
}
