|
From: | Noam Weissman |
Subject: | Re: [lwip-users] Correct way to free pbufs after tcp_recv callback finished |
Date: | Mon, 27 Jun 2016 14:55:06 +0000 |
Hi,
You need to call pbuf_free(pcb) after you finish processing the data.
Also you need to call tcp_recived after you handled the data. You call it NOT with the pcb that you get inside the recv call back but rather your SERVER pcb. The one created after calling listen.
I am not at my working PC so I cannot add an example but search around you will see what I mean.
BR, Noam. From: lwip-users <lwip-users-bounces+address@hidden> on behalf of Gabriel Harrison <address@hidden>
Sent: Monday, June 27, 2016 1:41 PM To: address@hidden Subject: [lwip-users] Correct way to free pbufs after tcp_recv callback finished Hi,
We’ve started our first lwIP project, following the instructions on http://lwip.wikia.com/wiki/Raw/TCP to create our high level functions and taking the device level IRQ functions and ethernetif.c from the SDK for our chip (Freescale Kinetis K60)
Although we appear to have set things up correctly – we can send & receive requests – the TCP pbufs pool is not running out and it looks like they are not being freed after the receive has been processed.
I can see in tcp_recv_null in tcp.c that pbuf_free(p); is called after tcp_recved(pcb, p->tot_len); but I can’t find any info about freeing the pbufs in the wiki via either pbuf_free or pbuf_free_callback.
Should I be calling pbuf_free/ pbuf_free_callback in our receive callback or is this supposed to be handled elsewhere?
Thanks,
Gabriel ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com ______________________________________________________________________ |
[Prev in Thread] | Current Thread | [Next in Thread] |