tornado.tcpclientIOStream connection factory

A non-blocking TCP connection factory.

class tornado.tcpclient.TCPClient(resolver=None, io_loop=None)[源代码]

A non-blocking TCP connection factory.

在 4.1 版更改: The io_loop argument is deprecated.

connect(*args, **kwargs)[源代码]

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.

在 4.5 版更改: Added the source_ip and source_port arguments.