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.
Use the diagram to trace event notifications from a transport to a protocol and writes in the opposite direction. section 8.2
