static public boolean isServerPortFree ( int port ) { ServerSocket s ; try { s = new ServerSocket ( port ) ; s . close ( ) ; } catch ( IOException e ) { return false ; } return true ; }
Check whether the specified server socket port is free or not . Be aware that this method is not safe if there are so many programs trying to open server sockets .