> Regarding of you saying stuff about examples online, I can't find any
> more "complex" example out there. All the examples have a really
> simple design, client sends message, receives message back and then
> the connection is closed. Is there any examples out there where
> connections are persistent and messages can come at any given time ?

Sure, just don't close the connection... ;^)
You get something at the recv callback, you send something back. Does it fit in the TCP buffer ? Then you send it. Are there any bytes left to send ? Yes, then you will send them _at the *sent* callback, not the poll callback. The poll callback is mostly for housekeeping and attending periodic tasks. The sent callback is fired when the other end acknowledged and there is room to send more data (that is why you couldn't send, because there was no room, so you have to wait for room, not for time, for room, and that happens when sent data can be discarded because the other end signals it has been received, and then the stack is sure it won't have to resend it, so it can free RAM. When you have to wait for time, because a close fails or something, then you'll use the poll callback.

I do believe the http server is more than pretty complex, and the smtp server is complex enough. Those are great examples and I've learned all I needed to learn just by watching closely at them. Start with the echo example, move perhaps to the netio example, and then go to smtp and then http.

There is also the wiki, which explains in detail all you need to know about the function calls. http://lwip.wikia.com/wiki/Raw/native_API


_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to