original_docstring: Returns true if successfully connests to host and port, false otherwise
  
      :param url: the healthcheck url (in the form tcp://host:port)
      :param timeout: timeout in seconds
      :returns: True if healthcheck succeeds within number of seconds specified by timeout, false otherwise
      
docstring: Returns true if successfully connests to host and port, false otherwise
docstring_tokens: Returns true if successfully connests to host and port false otherwise
code: def perform_tcp_healthcheck(url, timeout):
      """Returns true if successfully connests to host and port, false otherwise
  
      :param url: the healthcheck url (in the form tcp://host:port)
      :param timeout: timeout in seconds
      :returns: True if healthcheck succeeds within number of seconds specified by timeout, false otherwise
      """
      url_elem = urlparse(url)
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      sock.settimeout(timeout)
      result = sock.connect_ex((url_elem.hostname, url_elem.port))
      sock.close()
      if result == 0:
          return (True, "tcp connection succeeded")
      else:
          return (False, "%s (timeout %d seconds)" % (os.strerror(result), timeout))
code_tokens: def perform_tcp_healthcheck ( url , timeout ) : url_elem = urlparse ( url ) sock = socket . socket ( socket . AF_INET , socket . SOCK_STREAM ) sock . settimeout ( timeout ) result = sock . connect_ex ( ( url_elem . hostname , url_elem . port ) ) sock . close ( ) if result == 0 : return ( True , "tcp connection succeeded" ) else : return ( False , "%s (timeout %d seconds)" % ( os . strerror ( result ) , timeout ) )
short_docstring: Returns true if successfully connests to host and port, false otherwise
short_docstring_tokens: Returns true if successfully connests to host and port false otherwise
comment: """Returns true if successfully connests to host and port, false otherwise
  
      :param url: the healthcheck url (in the form tcp://host:port)
      :param timeout: timeout in seconds
      :returns: True if healthcheck succeeds within number of seconds specified by timeout, false otherwise
      """