/**
* 验证IP是否可连接
* @param host
* @param timeOut
* @return
*/
public static boolean isHostReachable(String host, Integer timeOut) {
if(isIP(host) && timeOut!=null){
try {
return InetAddress.getByName(host).isReachable(timeOut);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
验证IP是否可连接
最新推荐文章于 2024-06-15 11:00:42 发布