lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Sending UDP


From: Goldschmidt Simon
Subject: RE: [lwip-users] Sending UDP
Date: Tue, 11 Sep 2007 17:16:58 +0200

 
 
>What is the best way, pbuf_chain to do the same but just point the
newBuf->payload at the data without copying it!!
>       
>eg
>  newBuf = pbuf_alloc( PBUF_TRANSPORT, 1324, PBUF_RAM);
>  while( bytesToSend)
>  {
>    newBuf->payload = currentBufferPointer;
>    udp_send( outUdp, newBuf);
>    currentBufferPointer += 1324;
>    bytesToSend -= 1324;
>  }
>  pbuf_free( newBuf);

You must not modify the payload pointer directly for PBUF_RAM or
PBUF_POOL!!! In fact, you allocated memory when you called
pbuf_alloc(..., PBUF_RAM). When changing the payload pointer you don't
used that memory any more, is that what you intended? Maybe you want to
use PBUF_REF instead?

That said, we've had a discussion about PBUF_RAM at
http://savannah.nongnu.org/task/?6735 I think. I don't know exactly what
we decided, but there was a suggestion applications may not re-use
PBUF_RAM after passing it to an output function... Your report is
definitively worth a thought in that task!

Simon




reply via email to

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