code: public static boolean isSocketAlive(String host, int port) {
  	boolean socketAlive = false;
  	Socket socket = null;
  	
  	try {
  	    socket = new Socket(host, port);
  	    
  	    socketAlive = socket.isConnected();
  	} catch (Throwable t) {
  	    // do nothing
  	} finally {
  	    if (socket != null) {
  		try {
  		    socket.close();
  		} catch (IOException e) {
  		    // do nothing
  		}
  	    }
  	}
  	
  	return socketAlive;
      }
docs: Checks if the socket of specified host and port is alive.
  
  @param host
  - the host.
  @param port
  - the port.
  @return - true if alive, false otherwise.