[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] POST data using several packets
From: |
openocd |
Subject: |
Re: [lwip-users] POST data using several packets |
Date: |
Thu, 25 Jun 2009 18:42:32 +0200 (CEST) |
User-agent: |
SquirrelMail/1.4.16 |
I use timeouts so netconn_recv is only waiting 20 ticks or milliseconds
(can't remember right now) before the code continues and netconn_write is
called. I have double checked it.
> When "no data is being sent", does the code even reach netconn_write
> (wherever it is, it isn't in the code below), or could it be that it is
> stuck in the second call to netconn_recv (which is blocking, so does not
> return until there is more data!). If netconn_write was called, did you
> check its return value?
>
> I might be wrong, but as netconn_recv is blocking, I guess until the
> connection is closed, it will never return NULL, so your loop never ends.
>
> Simon
>
>
> Jesper Vestergaard wrote:
>> Kieran Mansley wrote:
>>
>>> On Wed, 2009-06-24 at 14:03 +0200, Jesper Vestergaard wrote:
>>>
>>>
>>>> what is the prober way of assembling
>>>> the data from a arbitrary number of packets?
>>>>
>>>>
>>> Call netconn_recv() repeatedly and concatenate the data you get until
>>> you have as much as you want.
>>>
>>> Kieran
>>>
>>>
>> I have tried calling netconn_recv() repeatedly but a problem has
>> occured. I get the data fine but when i will respond to the request with
>> netconn_write(pxNetCon, cDynamicPage, (u16_t)strlen( cDynamicPage ),
>> NETCONN_COPY ); no data is being sent. The code for retrieving the data
>> is here:
>>
>> /pxNetCon->recv_timeout=20;
>>
>> /* Data is ready */
>> pxRxBuffer = netconn_recv( pxNetCon );
>>
>> pcRxString = pvPortMalloc( mem_size );
>> do
>> {
>> /* Where is the data? */
>> netbuf_data( pxRxBuffer, ( void * ) &(pcRxString2),
>> &usLength );
>>
>> /* Allocate memory for the data */
>> mem_size = mem_size + usLength;
>> pcRxString = pvPortRealloc( pcRxString, (mem_size) );
>>
>> /* In the first iteration we can copy the data as it is */
>> if (mem_size == usLength)
>> {
>> memcpy(pcRxString, pcRxString2, usLength);
>> }
>> else
>> {
>> pcRxString3 = pvPortMalloc( usLength + 1 );
>> memcpy(pcRxString3, pcRxString2, usLength);
>> /* We use string functions on a char array so add a null
>> terminator */
>> pcRxString3[usLength] = '\0';
>> strcat( pcRxString, pcRxString3 );
>> vPortFree( pcRxString3 );
>> }
>> netbuf_free( pxRxBuffer );
>> pxRxBuffer = netconn_recv( pxNetCon );
>> //pxRxBuffer = NULL;
>> }
>> /* if theres is no more packets in the buffer proceed */
>> while (pxRxBuffer != NULL);/
>>
>>
>> If I comment the pxRxBuffer = netconn_recv( pxNetCon ); line and
>> uncomment pxRxBuffer = NULL; The data is sent like it should.
>> What is causing that and how do i fix it so i can recive multiple
>> packets but still respond to the request?/
>> /
>>
>>
>> _______________________________________________
>> lwip-users mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/lwip-users
>>
>>
>
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
- [lwip-users] POST data using several packets, Jesper Vestergaard, 2009/06/24
- Re: [lwip-users] POST data using several packets, address@hidden, 2009/06/25
- Re: [lwip-users] POST data using several packets,
openocd <=
- Re: [lwip-users] POST data using several packets, Jesper Vestergaard, 2009/06/26
- Re: [lwip-users] POST data using several packets, Simon Goldschmidt, 2009/06/26
- Re: [lwip-users] POST data using several packets, Jesper Vestergaard, 2009/06/26
- Re: [lwip-users] POST data using several packets, address@hidden, 2009/06/26