[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : [lwip-users] tcp_sent() question
From: |
Frédéric BERNON |
Subject: |
RE : [lwip-users] tcp_sent() question |
Date: |
Sun, 29 Jul 2007 09:58:16 +0200 |
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 : address@hidden
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : address@hidden [mailto:address@hidden 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
address@hidden http://lists.nongnu.org/mailman/listinfo/lwip-users
Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf
- RE : [lwip-users] tcp_sent() question,
Frédéric BERNON <=