aiocoap.transports.generic_udp module

class aiocoap.transports.generic_udp.GenericMessageInterface(mman: MessageManager, log, loop)

Bases: MessageInterface

GenericMessageInterface is not a standalone implementation of a message inteface. It does implement everything between the MessageInterface and a not yet fully specified interface of “bound UDP sockets”.

It delegates sending through the address objects (which persist through some time, given this is some kind of bound-socket scenario).

The user must: * set up a ._pool after construction with a shutdown and a connect method * provide their addresses with a send(bytes) method * pass incoming data to the _received_datagram and _received_exception methods

send(message)

Send a given Message object

async shutdown()

Deactivate the complete transport, usually irrevertably. When the coroutine returns, the object must have made sure that it can be destructed by means of ref-counting or a garbage collector run.

async determine_remote(request)

Return a value suitable for the message’s remote property based on its .opt.uri_host or .unresolved_remote.

May return None, which indicates that the MessageInterface can not transport the message (typically because it is of the wrong scheme).