PyDocs

Nav

Networking and Interprocess Communication

BufferedProtocol

asyncio

class (source) not WASI
  • BufferedProtocol(BaseProtocol)
Interface for stream protocol with manual buffer control.

Event methods, such as `create_server` and `create_connection`,
accept factories that return protocols that implement this interface.

The idea of BufferedProtocol is that it allows to manually allocate
and control the receive buffer.  Event loops can then use the buffer
provided by the protocol to avoid unnecessary data copies.  This
can result in noticeable performance improvement for protocols that
receive big amounts of data.  Sophisticated protocols can allocate
the buffer only once at creation time.

State machine of calls:

  start -> CM [-> GB [-> BU?]]* [-> ER?] -> CL -> end

* CM: connection_made()
* GB: get_buffer()
* BU: buffer_updated()
* ER: eof_received()
* CL: connection_lost()
Members of BufferedProtocol

b

buffer_updated
Called when the buffer was updated with the received data.

e

eof_received
Called when the other end calls write_eof() or equivalent.

g

get_buffer
Called to allocate a new receive buffer.
0 Examples
No examples for asyncio/BufferedProtocol.
See Also
No see-alsos for asyncio/BufferedProtocol
0 Notes
No notes for BufferedProtocol