Rawapi.txt said :

"- void tcp_sent(struct tcp_pcb *pcb,
                err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
                       u16_t len))

  Specifies the callback function that should be called when data has
  successfully been received (i.e., acknowledged) by the remote
  host. The len argument passed to the callback function gives the
  amount bytes that was acknowledged by the last acknowledgment."

What you have to understand is that tcp_sent enable to define your 
"user-callback" function which will be called each time there is new "free 
space" in your snd_buffer (most of time, you also have to defined tcp_arg). You 
call use it to "resend" data or terminate any tcp operations.

Most of time, for TCP "write" operations, you should check with tcp_sndbuf the 
size available in the "tcp send buffer", and you have to send no more than this 
size. You have to "loop" on that until all you block of data is write (is "in 
the send buffer"). You could avoid to poll is there is any free space in the 
"send buffer" by using tcp_sent callback: each time that any space is available 
in the tcp send buffer, your user-callback will be called, and you could retry 
to send datas... Like this, you replace you polling (which can used some 
cycles) by a "event" features (which use "no" cycles). Current CVS HEAD code 
for api_msg.c is a good sample for that. Take a look at it...
  
====================================
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 
====================================
P Avant d'imprimer, penser à l'environnement
 


-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de David Vos
Envoyé : dimanche 29 juillet 2007 03:58
À : Mailing list for lwIP users
Objet : [lwip-users] tcp_sent() question


I'm confused what the purpose of the tcp_sent() function is.  Could someone 
please explain it?

Thanks,
-David


_______________________________________________
lwip-users mailing list
[email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
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