Uasyncio raw IP protocol

AsyncRAW

Socket wrapper for the RAW IP protocol (not all boards supported)

Constructor

def __init__(self, af=usocket.AF_INET, proto=255)

Create a RAW asynchronous (non-blocking) socket. Set the IP protocol number to proto

Socket instance

def socket(self)

Returns the under-the-hood socket object

Connect

def connect(self, host)

Connect to a remote socket at address host. Note, that unlike the socket.connect() function this one accepts a string (ip or FQDN) - no port, obviously.

Receive data

async def recv(self, n)

Receive at most n bytes from the socket. Returns a bytes object with the received data or None (socket error). Socket must be in a connected state (see connect())

Send data

async def send(self, buf)

Send buf (bytes/bytearray object) to the socket. Socket must be in a connected state (see connect())

Close

async def close(self)

Mark the socket closed and release all resources