Java HTTP Port Find isPortAvailable(int port)

Here you can find the source of isPortAvailable(int port)

Description

is Port Available

License

Open Source License

Declaration

public static boolean isPortAvailable(int port) 

Method Source Code


//package com.java2s;
import java.net.Socket;

public class Main {
    public static boolean isPortAvailable(int port) {
        try {/*from w  w  w  .  j  a  v  a2  s  .  c om*/
            Socket s = new Socket("127.0.0.1", port);
            s.close();
            return false;
        } catch (Exception ex) {
            return true;
        }

    }
}

Related

  1. isOpen(final int port)
  2. isPortActive(String host, int port)
  3. isPortAvailable(final int port)
  4. isPortAvailable(int p)
  5. isPortAvailable(int port)
  6. isPortAvailable(int port)
  7. isPortAvailable(int port)
  8. isPortAvailable(int port)
  9. isPortAvailable(int port)