aiocoap.util.asyncio.recvmsg module¶
- class aiocoap.util.asyncio.recvmsg.RecvmsgDatagramProtocol¶
Bases:
BaseProtocol
Callback interface similar to asyncio.DatagramProtocol, but dealing with recvmsg data.
- datagram_msg_received(data, ancdata, flags, address)¶
Called when some datagram is received.
- datagram_errqueue_received(data, ancdata, flags, address)¶
Called when some data is received from the error queue
- error_received(exc)¶
Called when a send or receive operation raises an OSError.
- class aiocoap.util.asyncio.recvmsg.RecvmsgSelectorDatagramTransport(loop, sock, protocol, waiter)¶
Bases:
BaseTransport
A simple loop-independent transport that largely mimicks DatagramTransport but interfaces a RecvmsgSelectorDatagramProtocol.
This does not implement any flow control, based on the assumption that it’s not needed, for CoAP has its own flow control mechanisms.
- max_size = 4096¶
- close()¶
Close the transport.
Buffered data will be flushed asynchronously. No more data will be received. After all buffered data is flushed, the protocol’s connection_lost() method will (eventually) be called with None as its argument.
- sendmsg(data, ancdata, flags, address)¶
- async aiocoap.util.asyncio.recvmsg.create_recvmsg_datagram_endpoint(loop, factory, sock)¶
Create a datagram connection that uses recvmsg rather than recvfrom, and a RecvmsgDatagramProtocol protocol type.
This is used like the create_datagram_endpoint method of an asyncio loop, but implemented in a generic way using the loop’s add_reader method; thus, it’s not a method of the loop but an independent function.
Due to the way it is used in aiocoap, socket is not an optional argument here; it could be were this module ever split off into a standalone package.