If the ESP32 is configured as an asyncio echo server and the PC as a client the average go around time is 30 mSec
If the ESP32 is configured as an asyncio client contacting the PC running an echo server $ socat tcp-l:5000,fork exec:'bin/cat' the go around time is typical 430 mSec, 15 times slower than the other way around.
The reader, writer = await asyncio.open_connection(ip, port) requires 200 mSec while no other tasks are running.
Is there an explanation for this, can my code be improved?
Code: Select all
async def contactServer(ip, port, msg):
try:
reader, writer = await asyncio.open_connection(ip, port)
writer.write(msg)
await writer.drain()
r = await reader.read(1024)
except:
r = None
writer.close()
await writer.wait_closed()
return r