aiocoap.transports.tcp module¶
-
class
aiocoap.transports.tcp.
TcpConnection
(ctx, log, loop, *, is_server)¶ Bases:
asyncio.protocols.Protocol
,aiocoap.transports.rfc8323common.RFC8323Remote
,aiocoap.interfaces.EndpointAddress
-
scheme
¶ The that is used with addresses of this kind
This is usually a class property. It is applicable to both sides of the communication. (Should there ever be a scheme that addresses the participants differently, a scheme_local will be added.)
-
connection_made
(transport)¶ Called when a connection is made.
The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.
-
connection_lost
(exc)¶ Called when the connection is lost or closed.
The argument is an exception object or None (the latter meaning a regular EOF is received or the connection was aborted or closed).
-
data_received
(data)¶ Called when some data is received.
The argument is a bytes object.
-
eof_received
()¶ Called when the other end calls write_eof() or equivalent.
If this returns a false value (including None), the transport will close itself. If it returns a true value, closing the transport is up to the protocol.
-
pause_writing
()¶ Called when the transport’s buffer goes over the high-water mark.
Pause and resume calls are paired – pause_writing() is called once when the buffer goes strictly over the high-water mark (even if subsequent writes increases the buffer size even more), and eventually resume_writing() is called once when the buffer size reaches the low-water mark.
Note that if the buffer size equals the high-water mark, pause_writing() is not called – it must go strictly over. Conversely, resume_writing() is called when the buffer size is equal or lower than the low-water mark. These end conditions are important to ensure that things go as expected when either mark is zero.
NOTE: This is the only Protocol callback that is not called through EventLoop.call_soon() – if it were, it would have no effect when it’s most needed (when the app keeps writing without yielding until pause_writing() is called).
-
resume_writing
()¶ Called when the transport’s buffer drains below the low-water mark.
See pause_writing() for details.
-
-
class
aiocoap.transports.tcp.
TCPServer
¶ Bases:
aiocoap.transports.tcp._TCPPooling
,aiocoap.interfaces.TokenInterface
-
classmethod
create_server
(bind, tman: aiocoap.interfaces.TokenManager, log, loop, *, _server_context=None)¶
-
fill_or_recognize_remote
(message)¶ Return True if the message is recognized to already have a .remote managedy by this TokenInterface, or return True and set a .remote on message if it should (by its unresolved remote or Uri-* options) be routed through this TokenInterface, or return False otherwise.
-
shutdown
()¶
-
classmethod
-
class
aiocoap.transports.tcp.
TCPClient
¶ Bases:
aiocoap.transports.tcp._TCPPooling
,aiocoap.interfaces.TokenInterface
-
classmethod
create_client_transport
(tman: aiocoap.interfaces.TokenManager, log, loop, credentials=None)¶
-
fill_or_recognize_remote
(message)¶ Return True if the message is recognized to already have a .remote managedy by this TokenInterface, or return True and set a .remote on message if it should (by its unresolved remote or Uri-* options) be routed through this TokenInterface, or return False otherwise.
-
shutdown
()¶
-
classmethod