Java HTTP Port Find isOpen(final int port)

Here you can find the source of isOpen(final int port)

Description

Port is open.

License

Open Source License

Parameter

Parameter Description
port The port to check

Return

TRUE if it's open

Declaration

public static boolean isOpen(final int port) 

Method Source Code


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

public class Main {
    /**/*  www . java2  s  . c o  m*/
     * Port is open.
     * @param port The port to check
     * @return TRUE if it's open
     */
    public static boolean isOpen(final int port) {
        boolean open;
        try {
            new Socket((String) null, port);
            open = true;
        } catch (final IOException ex) {
            open = false;
        }
        return open;
    }
}

Related

  1. isLocalPortFree(final int port)
  2. isLocalPortOccupied(int portNum)
  3. isLocalPortUsed(int port)
  4. isLoclePortUsing(int port)
  5. isMulticastSupported(NetworkInterface pNif)
  6. isPortActive(String host, int port)
  7. isPortAvailable(final int port)
  8. isPortAvailable(int p)
  9. isPortAvailable(int port)