[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-devel] lwip_recvfrom(sock == 0)
From: |
Gisle Vanem |
Subject: |
[lwip-devel] lwip_recvfrom(sock == 0) |
Date: |
Thu, 24 Sep 2020 18:05:57 +0200 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Hello list.
I have patched MicroPython [1] with LwIP support on Windows.
And running some tcp/ip related test shows a funny
behaviour in LwIP. E.g. from:
https://github.com/micropython/micropython/blob/master/tests/extmod/usocket_tcp_basic.py
# recv() on a fresh socket should raise ENOTCONN
s = socket.socket()
try:
s.recv(1)
except OSError as er:
print("ENOTCONN:", er.args[0] == errno.ENOTCONN)
The trace in LwIP shows:
src/api/sockets.c(1754): lwip_socket(PF_INET, SOCK_STREAM, 0) = 0
src/api/sockets.c(1243): lwip_recvfrom(0, 0E88A030, 1, 0x0, ..)
src/api/sockets.c(976): lwip_recv_tcp: top while sock->lastdata=00000000
Now the MicroPython test hangs forever. Nothing happens
with this socket 0. It's unconnected, so how could this socket
ever receive a single byte?
Using the same .py-test in the real CPython 3.6, it immediately
returns the expected:
py -3 extmod\usocket_tcp_basic.py
ENOTCONN: True
Could it be some of my 'LWIP_x' options are messed up?
[1] https://github.com/micropython/micropython
- [lwip-devel] lwip_recvfrom(sock == 0),
Gisle Vanem <=