List of utility methods to do HTTP Port Find
boolean | isLocalPortOccupied(int portNum) is Local Port Occupied Socket s = new Socket(); try { s.connect(new InetSocketAddress(portNum)); return s.isConnected(); } catch (Exception e) { return false; } finally { try { ... |
boolean | isLocalPortUsed(int port) Check if aport is being used in the local host boolean flag = true; try { flag = isPortUsing("127.0.0.1", port); } catch (Exception e) { return flag; |
boolean | isLoclePortUsing(int port) true:already in using false:not using boolean flag = true; try { flag = isPortUsing("127.0.0.1", port); } catch (Exception e) { return flag; |
boolean | isMulticastSupported(NetworkInterface pNif) Check whether the given interface supports multicast and is up return pNif != null && checkMethod(pNif, isUp) && checkMethod(pNif, supportsMulticast);
|
boolean | isOpen(final int port) Port is open. boolean open; try { new Socket((String) null, port); open = true; } catch (final IOException ex) { open = false; return open; ... |
boolean | isPortActive(String host, int port) is Port Active Socket s = null; try { s = new Socket(); s.setReuseAddress(true); SocketAddress sa = new InetSocketAddress(host, port); s.connect(sa, 3000); return true; } catch (IOException e) { ... |
boolean | isPortAvailable(final int port) Checks if the specified is available as listen port. try (ServerSocket tcp = new ServerSocket(port); DatagramSocket udp = new DatagramSocket(port)) { return tcp.isBound() && udp.isBound(); } catch (Exception e) { return false; |
boolean | isPortAvailable(int p) is Port Available try { ServerSocket test = new ServerSocket(p); test.close(); } catch (BindException e) { return false; } catch (IOException e) { return false; return true; |
boolean | isPortAvailable(int port) Checks to see if a specific port is available. if ((port < MIN_PORT_NUMBER) || (port > MAX_PORT_NUMBER)) return false; ServerSocket ss = null; DatagramSocket ds = null; try { ss = new ServerSocket(port); ss.setReuseAddress(true); ds = new DatagramSocket(port); ... |
boolean | isPortAvailable(int port) is Port Available try { Socket s = new Socket("127.0.0.1", port); s.close(); return false; } catch (Exception ex) { return true; |