On this page
asyncio.DatagramTransport
Prev: asyncio.DatagramProtocol | Up: asyncio | Next: asyncio.eager_task_factory
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.DatagramTransport
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import DatagramTransport
Signature & Overview
asyncio.DatagramTransport(extra=None)
Interface for datagram (UDP) transports.
Methods & Attributes
DatagramTransport.abort(self)— Close the transport immediately.DatagramTransport.close(self)— Close the transport.DatagramTransport.get_extra_info(self, name, default=None)— Get optional transport information.DatagramTransport.get_protocol(self)— Return the current protocol.DatagramTransport.is_closing(self)— Return True if the transport is closing or closed.DatagramTransport.sendto(self, data, addr=None)— Send data to the transport.DatagramTransport.set_protocol(self, protocol)— Set a new protocol.
Usage
import asyncio
# Transport interface for UDP endpoints (exposes sendto())
assert issubclass(asyncio.DatagramTransport, asyncio.BaseTransport)
Gotchas
- UDP is fire-and-forget:
transport.sendto(data, addr)does not guarantee delivery or ordering.
REPL Inspect
from asyncio import DatagramTransport
help(DatagramTransport)
Linked from
Related notes
- tuts/python3/stdlib_module/asyncio/DatagramProtocol Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/eager_task_factory Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractEventLoop Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractServer Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/Barrier shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseEventLoop shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol shared tags: #asyncio, #stdlib