|
From: | address@hidden |
Subject: | Re: [lwip-users] handle slow TCP handling |
Date: | Tue, 27 Nov 2018 19:39:50 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 |
On 27.11.2018 17:16, Pierre Chatelier
wrote:
Hello, I didn' know that one. The wiki is not as well maintained as it should be, so it's always better to read the main documentation at http://www.nongnu.org/lwip/ -call tcp_recved(pcb, written);//if I was still able to handle "written" bytes, and in that case obviously "written" is less than p->tot_len No, you cannot combine "tcp_recved" with returning != ERR_OK. Because when returning ERR_MEM, the stack will buffer this pbuf and pass it back to you later. You'll end up with calling tcp_recved for some bytes more than once.
Actually, that *is* expected. Returning ERR_MEM can only be the last resort. It destroys some TCP assumptions. You should rather keep the pbuf on a list for yourself and return ERR_OK and process it at some later time, calling 'tcp_recved' after processing it. This will send ACKs immediately (TCP depends on that) but the window will close and will be reopened for the remote host to send more once you called 'tcp_recved'. If you can't buffer all pbufs, decrease your TCP_WND size. Simon |
[Prev in Thread] | Current Thread | [Next in Thread] |