public static boolean ping(String ipAddress) throws Exception{
    int timeOut=3000;
    boolean status= InetAddress.getByName(ipAddress).isReachable(timeOut);   // 当返回值是true时,说明host是可用的
    return status;
}
Last modification:August 16th, 2021 at 03:53 pm
如果觉得我的文章对你有用,请随意赞赏