Wio rp2040 socket communication - a deep frustration :(

Four days of work without any progress. Let me give the details and maybe anyone can help.

:arrow_right: Connecting to Wifi: OK :slightly_smiling_face:

:arrow_right: Resolving addresses: not working! :frowning_face:

s = socket.socket()
ai = socket.getaddrinfo("wikipedia.com", 80)
print("Bind address info:", ai)

Result on Windows (as expected):

Bind address info: [(<AddressFamily.AF_INET: 2>, 0, 0, '', ('', 80))]

Result on board ( is not useful):

Bind address info: [(2, 1, 0, '', ('', 80))]

:arrow_right: Listening to ports: impossible :frowning_face:

s = socket.socket()
print([n for n in dir(s) if not n.startswith('_')])

s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

Result: these three command all fail because they were ‘taken out’ of the socket library in this firmware:

['close', 'read', 'readinto', 'readline', 'send', 'write', 'connect', 'recv', 'recvfrom', 'sendto', 'setblocking', 'settimeout']
AttributeError: 'socket' object has no attribute 'setsockopt'

:arrow_right: sendind data: ok :slightly_smiling_face:, until it is stuck :angry::angry::angry:

s.send('ABCDEFGH' * 2)

I used the NetAssistant as a tcp server in ‘group chat’ mode that echos back every sent data.
When using ‘* 2’ for sending 16 bytes, it’s usually ok. When changing to ‘* 10’ for 80 bytes, after several tries it is stuck on sending, in a way that the COM port will become useless even if I disconnect and reconnect the board. Sometimes only reloading a firmware will make it usable again!

:arrow_right: reading data: ok :slightly_smiling_face:, but only for small amounts :angry:

s.send('ABCDEFGH' * 10)
while True:
    data = s.recv(8)

Reading 8 bytes usually succeeds. Reading 80 bytes fails 50% of the time (with a timeout). And the loop NEVER succeeds more than once. If the server send more than the bytes specified for the recv parameter, it will not read the rest and will fail with a timeout.

Conclusion: I’d be happy to hear of anybody with better results.

And BTW the support team is quite responsive, but pointed me to demo code which fails to run. I tested on two different boards, so I don’t think my board is broken.

hello, please, did you manage to solve this problem?

No, sorry, I gave up working with this board

I see the same problem with receiving data through the TCP sockets - please see my posts.

Is there any way to make Seeed support look into this problem? Do they have real support team?