lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] TCP Raw API questions about efficiency and threads


From: Pîrvu Mihai
Subject: Re: [lwip-users] TCP Raw API questions about efficiency and threads
Date: Mon, 20 Jun 2016 22:06:39 +0300

Hello guys, I'm posting here to tell you that the problem was much simpler than I thought. Once I disabled Nage's Algorithm for all the PCBs and called tcp_output after every write, the speed increased dramatically (similar to my netconn UDP implementation).

I guess those are enabled by default for good reasons, but in my case it was adding a way too big of a delay.

Mihai

On Wed, Jun 8, 2016 at 3:43 PM, Sergio R. Caprile <address@hidden> wrote:
> 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
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

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