liveBook · Manning

Transport

As explained in Python Concurrency with asyncio

An asyncio transport is a low-level abstraction that manages the transmission and reception of data over an underlying communication resource.

An asyncio transport is a low-level abstraction for sending and receiving data through a socket or another stream, then closing that resource. section 8.2

Transports handle data transmission; protocols handle connection lifecycle and application responses. The transport calls protocol methods when connections are established or data arrives, while the protocol can write through the transport. section 8.2

Common transport roles include:

  • ReadTransport for receiving data. section 8.2
  • WriteTransport for sending data. section 8.2
  • Transport for general communication, with additional variants for UDP and subprocess communication. section 8.2

HTTP GET client

A protocol receives its transport in connection_made, writes an HTTP request, processes incoming bytes in data_received, and completes the response through a Future. section 8.2

Figure 8.2 A transport calls methods on a protocol when events happen. A protocol can write data to a transport.
08-02

Use the diagram to trace event notifications from a transport to a protocol and writes in the opposite direction. section 8.2

How Python Concurrency with asyncio covers it

How deep it goes
Defines transport operations, implementation types, and protocol callbacks through a basic HTTP request.
Examples
Demonstrates a single HTTP GET request using connection_made, data_received, a Future, and create_connection.
What it assumes
Assumes familiarity with socket-style reading, writing, and closing while introducing callback-based asynchronous APIs.
What you can do after
Build a callback-based asyncio HTTP client with a custom protocol and transport.
How it connects
Connects transports with asyncio streams, protocols, sockets, callbacks, and HTTP clients.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Python Concurrency with asyncio. The section links point to the parts of the book it draws on.