code: static public boolean isServerPortFree(int port){
  		ServerSocket s;
  		try {
  			s = new ServerSocket(port);
  			s.close();
  		} catch (IOException e) {
  			return false;
  		}
  		return true;
  	}
docs: 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.
  @param port the port number to be checked
  @return true if the port is free, or false if it is being used by other program.