lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] possible bug?


From: Jesper Vestergaard
Subject: Re: [lwip-users] possible bug?
Date: Wed, 17 Jun 2009 16:41:34 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Kieran Mansley wrote:
On Wed, 2009-06-17 at 15:45 +0200, Jesper Vestergaard wrote:
I'm using FreeRTOS version 5.20 as OS and do

netbuf_data( pxRxBuffer, ( void * ) &pcRxString, &usLength );
printf("%s\n"), pcRxString);

to get the info.

It's the printf that's causing the problem.  I bet that the same netbuf
(pxRxBuffer) has been used for the two packets without zeroing the
contents inbetween.  The second packet overwrites the first, but of
course netbuf_data doesn't NULL terminate the received packet data to
produce a string usable by printf, and so when you use printf it carries
on printing the old data after the new data until it gets to NULL
character.  It worked the first time because the netbuf was probably
initialized to have zeroed contents.  The usLength field tells you how
much of the pcRxString is valid, so you can write a NULL at this point
if you need to print it using printf.

Kieran



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


I use strstr to search in it:

if (strstr(pcRxString, cSearchString) != NULL )
   controlLED(led,LED_ON);

which have the same problem. So guess it's the avr32 toolchain that is causing the problem.

Thank you for helping me




reply via email to

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