Uasyncio TCP Client
from uasyncio_tcp import TCPClient
TCPClient
Constructor
def __init__(self, host, port)
Initializes a TCP client, that will connect to a TCP server at host:port
Connect
async def connect(self)
Creates a non-blocking TCP socket and tries to connect to a TCP server at host:port
Send data
async def send(self, data, attempts=3)
Send buf
(bytes/bytearray object) to the socket. Socket must be in a connected state (see connect()
)
Receive data
async def recv(self, n=-1)
Receive at most n
(-1 - all available) bytes from the socket. Socket must be in a connected state (see connect()
)
Close
async def close(self)
Mark the socket closed and release all resources