lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Issues with netconn callbacks


From: address@hidden
Subject: Re: [lwip-users] Issues with netconn callbacks
Date: Mon, 2 Dec 2019 21:24:28 +0100
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

Am 02.12.2019 um 20:39 schrieb Davide Bettio:
Hello,

I'm the author of AtomVM (https://github.com/bettio/AtomVM) and we are
using lwip on ESP32.

So you're running the stock lwIP that comes with ESP32? If so, I don't
know how "vanilla" this is and how they keep their copy of lwIP up to
date...


We decided to use netconn API since it provides us asynchronous callbacks.
However I'm experiencing an unexpected behavior with it (when using it
as a TCP server):
I get my callback called also for netconns which I didn't accept yet.

I'm not sure I understand that. Just for you to know: netconn is the
basis of the standard socket implementation in lwIP but otherwise not
may not too be widely used.

Being like that, you *may* get problems when using netconn in a
different way than the socket API uses it internally. Maybe you can
cross-check your code against sockets.c and see if you do anything
different?


So I get this output from my code:

handler not found for: 0x3ffc3bf4
processed all events
found handler for: 0x3ffcd464
tcp_server_handler
going to send a ready message
accepted conn: 0x3ffc3bf4
accepted_socket

Is this an intended behavior?

That's no debug output from lwIP


Also I have further questions about the netconn API:

- Is it possible to check if any byte is already in the buffer ready to
be received?

Yes, you can use nonblocking receive. Again, see sockets.c if you need
an example.

- Is it possible to check if a netconn is still open or it has been closed?

Well, you get informed it is closed and you'll get an error trying to
use it...

Regards,
Simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]