liveBook · Manning

Eof_received

As explained in Python Concurrency with asyncio

eof_received is an asyncio protocol callback invoked when the transport receives an end-of-file indication.

eof_received is an asyncio protocol callback that marks the end of incoming data. For a socket, it runs when the server closes the connection; afterward, data_received will not run again. section 8.2

Use its return value to choose transport shutdown behavior:

  • Return False to let the transport close itself. section 8.2
  • Return True when the protocol implementation will perform shutdown logic. section 8.2

Completing an HTTP response

A protocol can accumulate chunks from data_received, then set an internal Future's result in eof_received. A get_response coroutine awaits that Future, allowing callers to receive the completed response after the connection ends. section 8.2

How Python Concurrency with asyncio covers it

How deep it goes
Explains invocation timing, the data_received guarantee, Boolean shutdown semantics, and Future completion without deeper transport internals.
Examples
Uses an HTTP client protocol that buffers response bytes and completes a Future when the server closes the connection.
What it assumes
Assumes familiarity with asyncio transports, protocols, data_received, socket connections, and Future objects.
What you can do after
Build an asyncio protocol that detects response completion and delegates or performs transport shutdown.
How it connects
Connects asyncio protocols with transports, sockets, data_received, buffering, and Future-based result delivery.

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.