PyDocs

Nav

Networking and Interprocess Communication

open_connection

asyncio

async function (source) not WASI
  • open_connection(host=None, port=None, *, limit=65536, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None)
A wrapper for create_connection() returning a (reader, writer) pair.

The reader returned is a StreamReader instance; the writer is a
StreamWriter instance.

The arguments are all the usual arguments to create_connection()
except protocol_factory; most common are positional host and port,
with various optional keyword arguments following.

Additional optional keyword arguments are loop (to set the event loop
instance to use) and limit (to set the buffer limit passed to the
StreamReader).

(If you want to customize the StreamReader and/or
StreamReaderProtocol classes, just copy the code -- there's
really nothing special here except some convenience.)
Changed in 3.7, 3.8, 3.10, 3.11
  • 3.7: Added the ssl_handshake_timeout parameter.
  • 3.8: Added the happy_eyeballs_delay and interleave parameters.
  • 3.10: Removed the loop parameter.
  • 3.11: Added the ssl_shutdown_timeout parameter.
0 Examples
No examples for asyncio/open_connection.
See Also
No see-alsos for asyncio/open_connection
0 Notes
No notes for open_connection