PyDocs

Nav

Networking and Interprocess Communication

Protocol

asyncio

class (source) not WASI
  • Protocol(BaseProtocol)
Interface for stream protocol.

The user should implement this interface.  They can inherit from
this class but don't need to.  The implementations here do
nothing (they don't raise exceptions).

When the user wants to requests a transport, they pass a protocol
factory to a utility function (e.g., EventLoop.create_connection()).

When the connection is made successfully, connection_made() is
called with a suitable transport object.  Then data_received()
will be called 0 or more times with data (bytes) received from the
transport; finally, connection_lost() will be called exactly once
with either an exception object or None as an argument.

State machine of calls:

  start -> CM [-> DR*] [-> ER?] -> CL -> end

* CM: connection_made()
* DR: data_received()
* ER: eof_received()
* CL: connection_lost()
Members of Protocol

d

data_received
Called when some data is received.

e

eof_received
Called when the other end calls write_eof() or equivalent.
0 Examples
No examples for asyncio/Protocol.
See Also
No see-alsos for asyncio/Protocol
0 Notes
No notes for Protocol