用过这个方法没?
:调出DOS窗口,ping IP或域名,有返回值就是开启的,这个应该是最快的了。
[mw_shl_code=java,true] public static String pingIpAddr() { String pingInfo = "ok"; try { String ipAddress = "123.123.1.13"; Process p = Runtime.getRuntime().exec("ping -c 1 -w 100 " + ipAddress); int status = p.waitFor(); if (status == 0) { return pingInfo; } else { pingInfo = "错误:服务器没开启"; } } catch (IOException e) { pingInfo = "错误:服务器IO错误"; } catch (InterruptedException e) { pingInfo = "错误:网络拥堵"; } return pingInfo; }[/mw_shl_code]