public static boolean testIpPortIfNotLink(String ip, String port) { Socket client = null; try { client = new Socket(ip, Integer.parseInt(port)); client.close(); return true; } catch (Exception e) { return false; } }
来源:oschina
链接:https://my.oschina.net/thomas2/blog/3196744