public static boolean isPortAvailable ( final int port ) { try ( ServerSocket tcp = new ServerSocket ( port ) ; DatagramSocket udp = new DatagramSocket ( port ) ) { return tcp . isBound ( ) && udp . isBound ( ) ; } catch ( Exception e ) { //NOSONAR return false ; } }
Checks if the specified is available as listen port .