Книга: Learning Concurrency in Python
Назад: Output
Дальше: Protocols


Transports are classes that come included within the asyncio module that allow you to implement various types of communication. In total, there are four distinct types of transports that each inherit from the BaseTransport class:

  • ReadTransport
  • WriteTransport
  • DatagramTransport
  • BaseSubprocesTransport

This BaseTransport class has five methods that are subsequently transient across all four transport types listed earlier:

  • close(): This closes the transport
  • is_closing(): This returns true if the transport is closing or is already closed
  • get_extra_info(name, default=None): This returns optional transport information.
  • set_protocol(protocol): This does exactly what it says on the tin
  • get_protocol(): This returns the current protocol


Назад: Output
Дальше: Protocols