>Isnt it a socket api function?
netbuf_copy_partial is more a netconn api,than a socket one (but in current 
code, socket layer is based on netconn layer). But it's just to show you how to 
process a pbuf (where data can be in several blocks). So, don't use it 
directly, but look how it's implemented to do the same thing.
 
>I am only taking the data of the first current pbuf received
Be carefull, the "first current pbuf received" can be a chain: by example, if 
your port use a 128bytes pool size, and you receive a full packet (saying, 1500 
bytes), the pbuf you will receive will be a pbuf chain of 12 "blocks" 
(~1500/128). More, if you only want to read the first pbuf of the chain, don't 
use "tot_len" (the total pbuf chain size), but "len" (the pbuf node size).
 
> more longer than 10 chars so I guess it shouldn't cause the software to crash
But with any "string" function (like sprintf), you HAVE TO alloc one byte more 
for the zero-terminal...
 
>regarding sprintf, is memcpy better?
Of course!!!
 
 
  
====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : [EMAIL PROTECTED] 
Web Site : http://www.hymatom.fr <http://www.hymatom.fr/>  
====================================
P Avant d'imprimer, penser à l'environnement
 

        -----Message d'origine-----
        De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Louis 
Filasky
        Envoyé : mardi 10 juillet 2007 21:16
        À : [email protected]
        Objet : RE : [lwip-users] Weird behavior of lwIP with C functions
        
        
        Hi Frederic,
        
        Thank you for your quick reply,
        
        Well, I was wondering about the netbuf_copy_partial function you talked 
to me about. Isnt it a socket api function? I am using the raw api and well, I 
can see what you mean when you say that there is a chain of pbuf when data is 
received and I am only taking the data of the first current pbuf received. You 
re right saying it could be handled better, still the command line I am sending 
to Virtex II are no more longer than 10 chars so I guess it shouldn't cause the 
software to crash. Besides I debugged the code by removing some
        parts and see how the server behaves. No problem appears to come before 
i check the commandType variable with a strncpy, then in this if, it starts 
behaving weirdly.
        
        Anyway, regarding sprintf, is memcpy better?
        
        Thanks again,
        
        Antoine.
        
        
  _____  

        Besoin d'un e-mail ? Créez gratuitement un compte Windows Live Hotmail 
et bénéficiez de 2 Go de stockage ! Windows Live Hotmail 
<http://www.windowslive.fr/hotmail/default.asp>  

<<image001.jpg>>

<<image002.jpg>>

BEGIN:VCARD
VERSION:2.1
N:BERNON;Frédéric;;M.
FN:Frédéric BERNON
ORG:HYMATOM SA;Recherche et Développement
TITLE:Chef de projet informatique
TEL;WORK;VOICE:04-67-87-61-10
TEL;WORK;FAX:04-67-70-85-44
ADR;WORK;ENCODING=QUOTED-PRINTABLE:;23;Zone Industrielle=0D=0A175 rue de Massacan;VENDARGUES;;34740;FRANCE;
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:23=0D=0AZone Industrielle=0D=0A175 rue de Massacan=0D=0AVENDARGUES 34740=0D=
=0AFrance
URL;WORK:http://www.hymatom.fr
ROLE:Chef de projet informatique
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20020404T083210Z
END:VCARD
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to