lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] netconn: freeing netbufs after netconn_recv


From: Ivan Delamer
Subject: Re: [lwip-users] netconn: freeing netbufs after netconn_recv
Date: Thu, 1 Nov 2007 07:51:25 -0700 (PDT)

Thanks Simon,

BTW, I have never contributed code here before, but perhaps the netbuf_delete 
could be added to the HTTP example? How is that posted?

If the HTTP server I'm making is half decent I'll post it in case anybody is 
interested.

Regards
Ivan


----- Mensaje original ----
De: Simon Goldschmidt <address@hidden>
Para: Mailing list for lwIP users <address@hidden>
Enviado: jueves 1 de noviembre de 2007, 4:35:32
Asunto: Re: [lwip-users] netconn: freeing netbufs after netconn_recv


Am 31.10.2007 um 21:23 schrieb Ivan Delamer:

> ...
> Now, I have two questions/concerns:
>
> 1) do I have to manually free/delete the netbuf? I read the source  
> code for netconn_recv and I see a buf = memp_malloc(MEMP_NETBUF)  
> but no "free" in the examples.

Yes, look at sockets.c, lwip_recv() implementation for an example.

>
> 2) for how long is the data in the netbuf valid? netconn_recv sends  
> a API_MSG_RECV so does this mean that the data may be overwritten?  
> or does it stay valid until I free the netbuf (and underlying pbufs)?

Data stays valid until you free the netbuf. API_MSG_RECV updates the  
TCP window so that the remote side can send more data. If you don't  
free the netbuf, you will eventually run out of pbufs/netbufs.

>
> The way I see it, I should call netbuf_delete() after I'm done  
> processing the data, but I couldn't find any example of this.

As mentioned above, look at sockets.c, lwip_recv() implementation.

>
> Thanks in advance again,
> Ivan
>
> PS: anybody have an HTTPD server sample? something more complex  
> than the example, I will use a thread pool for processing requests  
> and hopefully implement keep-alive.

The only netconn HTTPD example I know of is in the CVS contrib  
module, apps directory.


Simon




_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users


      Los referentes más importantes en compra/ venta de autos se juntaron:
Demotores y Yahoo!
Ahora comprar o vender tu auto es más fácil. Vistá ar.autos.yahoo.com/




reply via email to

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