Thanks for the explanation. I had read some old documentation somewhere that suggested that lwip required you to handle resending data yourself (the data due to lost packets). Now I see why this function is useful in other ways.
Thanks, -David On 7/29/07, Frédéric BERNON <[EMAIL PROTECTED]> wrote: > 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 > > _______________________________________________ > lwip-users mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/lwip-users > > _______________________________________________ lwip-users mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/lwip-users
