class_docstr: A non-blocking TCP connection factory.
  
  .. versionchanged:: 4.1
     The ``io_loop`` argument is deprecated.
docstr: Connect to the given host and port.
  
  Asynchronously returns an `.IOStream` (or `.SSLIOStream` if
  ``ssl_options`` is not None).
  
  Using the ``source_ip`` kwarg, one can specify the source
  IP address to use when establishing the connection.
  In case the user needs to resolve and
  use a specific interface, it has to be handled outside
  of Tornado as this depends very much on the platform.
  
  Similarly, when the user requires a certain source port, it can
  be specified using the ``source_port`` arg.
  
  .. versionchanged:: 4.5
     Added the ``source_ip`` and ``source_port`` arguments.
docstr_tok: ["Connect","to","the","given","host","and","port",".","Asynchronously","returns","an","`",".IOStream","`","(","or","`",".SSLIOStream","`","if","``","ssl_options","``","is","not","None",")",".","Using","the","``","source_ip","``","kwarg",",","one","can","specify","the","source","IP","address","to","use","when","establishing","the","connection",".","In","case","the","user","needs","to","resolve","and","use","a","specific","interface",",","it","has","to","be","handled","outside","of","Tornado","as","this","depends","very","much","on","the","platform",".","Similarly",",","when","the","user","requires","a","certain","source","port",",","it","can","be","specified","using","the","``","source_port","``","arg",".","..","versionchanged",":",":","4.5","Added","the","``","source_ip","``","and","``","source_port","``","arguments","."]
code: def connect(
      self,
      host,
      port,
      af=socket.AF_UNSPEC,
      ssl_options=None,
      max_buffer_size=None,
      source_ip=None,
      source_port=None,
  ):
      """Connect to the given host and port.
  
      Asynchronously returns an `.IOStream` (or `.SSLIOStream` if
      ``ssl_options`` is not None).
  
      Using the ``source_ip`` kwarg, one can specify the source
      IP address to use when establishing the connection.
      In case the user needs to resolve and
      use a specific interface, it has to be handled outside
      of Tornado as this depends very much on the platform.
  
      Similarly, when the user requires a certain source port, it can
      be specified using the ``source_port`` arg.
  
      .. versionchanged:: 4.5
         Added the ``source_ip`` and ``source_port`` arguments.
      """
      addrinfo = yield self.resolver.resolve(host, port, af)
      connector = _Connector(
          addrinfo,
          self.io_loop,
          functools.partial(
              self._create_stream,
              max_buffer_size,
              source_ip=source_ip,
              source_port=source_port,
          ),
      )
      af, addr, stream = yield connector.start()
      # TODO: For better performance we could cache the (af, addr)
      # information here and re-use it on subsequent connections to
      # the same host. (http://tools.ietf.org/html/rfc6555#section-4.2)
      if ssl_options is not None:
          stream = yield stream.start_tls(
              False, ssl_options=ssl_options, server_hostname=host
          )
      raise gen.Return(stream)
  
imports: from __future__ import absolute_import, division, print_function
  import functools
  import socket
  from tornado.concurrent import Future
  from tornado.ioloop import IOLoop
  from tornado.iostream import IOStream
  from tornado import gen
  from tornado.netutil import Resolver
  from tornado.platform.auto import set_close_exec
label_desc: Use image node_id 3 for calling the TCPClient obj's underlying member method code with example usage: obj.connect(host, port, af, ssl_options, max_buffer_size, source_ip, source_port) without return types