List of utility methods to do HTTP Port Find
boolean | isPortUsing(String host, int port) Check if a port is being used in the specified host boolean flag = false; try { InetAddress theAddress = InetAddress.getByName(host); Socket socket = new Socket(theAddress, port); flag = true; } catch (IOException e) { return flag; ... |
boolean | isPortUsing(String host, int port) true:already in using false:not using boolean flag = false; InetAddress theAddress = InetAddress.getByName(host); try { Socket socket = new Socket(theAddress, port); flag = true; } catch (IOException e) { return flag; ... |
boolean | isReachable(final String hostName, int port, int timeout) Checks that given hostname is reacheble in certain timeout. try (Socket socket = new Socket()) { socket.connect(new InetSocketAddress(hostName, port), timeout); return true; } catch (IOException ignore) { return false; |
boolean | isReachableByPing(String host, int port) is Reachable By Ping Socket ignored = null; try { ignored = new Socket(host, port); ignored.close(); return true; } catch (IOException e) { return false; |
boolean | isServerListening(String host, int port) Checks if the server is listening using the host name and the port number specified. Socket socket = null; try { socket = new Socket(host, port); return true; } catch (Exception e) { return false; } finally { if (socket != null) { ... |
boolean | isServerListening(String host, int port) is Server Listening try { Socket s = new Socket(host, port); return true; } catch (Exception ex) { return false; |
boolean | isServerPortFree(int port) Check whether the specified server socket port is free or not. ServerSocket s; try { s = new ServerSocket(port); s.close(); } catch (IOException e) { return false; return true; ... |
boolean | isServing(String host, int port) is Serving if (port < 0) { return false; try { Socket socket = new Socket(host, port); socket.close(); return true; } catch (IOException e) { ... |
boolean | isStart(String host, int port) is Start return isStart1(host, port);
|
boolean | isStart0(String host, int port) is Start boolean status = false; Socket socket = null; try { socket = new Socket(host, port); status = true; socket.close(); } catch (Exception e) { } finally { ... |