I write a simple function using the lwip api .  the function is followed.
 
static void vProcessTCPConnection( struct netconn *pxNetCon )
{
struct netbuf *pxRxBuffer;
portCHAR *pcRxString;
unsigned portSHORT usLength;
 
      while((pxRxBuffer = netconn_recv( pxNetCon )) != NULL)
      {
            netbuf_data(pxRxBuffer, ( void * ) &pcRxString, &usLength);
            netconn_write(pxNetCon, pcRxString, usLength, NETCONN_COPY);
            //memp_free(MEMP_NETBUF, pxRxBuffer);
      }
      netbuf_delete( pxRxBuffer );
      netconn_close( pxNetCon );
}
 
   after I run the function , I connect to target running the funciton from a pc.
I input some characters, the pc endpoint will send these characters to target.
after the target received character, then send back .
   I found I only send 4 times. if I add memp_free(MEMP_NETBUF, pxRxBuffer);
I can send 16 times.
  
   Can anybody tell me how to correctly release the memory ?
 
thanks
Boter

_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to