[Top][All Lists]

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

RE : [lwip-devel] tcp_connect failure not calling connected callback

From: Frédéric BERNON
Subject: RE : [lwip-devel] tcp_connect failure not calling connected callback
Date: Fri, 1 Jun 2007 09:23:49 +0200


>From memory, with callback api (LWIP_CALLBACK_API=1, which is the default 
>value), tcp_connect is asynchrone (the function return without waiting a error 
>condition or the real connection). 

If you want a "sample" for that, look api_msg.c file (the "raw" part of the 
sequential api). If I resume, a tcp client would be initialize like this (no 
error checking to simplify):

tcp_pcb* pcb = tcp_new();
tcp_arg(pcb, your_arg); /* "your_arg" is a "user data", any value you want to 
get when callbacks are invoked */
tcp_recv(pcb, recv_tcp); /* set "recv callback" */
tcp_sent(pcb, sent_tcp); /* set "send callback" */
tcp_poll(pcb, poll_tcp, 4); /* set "poll callback" */
tcp_err(pcb, err_tcp);   /* set "error callback" */
tcp_bind(pcb, ipaddr, port);
tcp_connect(pcb, ipaddr, port, do_connected); /* set "connected callback" */

After that, the final "result" is known when "do_connected" XOR "err_tcp" is 
called. If you really want to be sure, process both cases (do_connected with 
err!=ERR_OK, and err_tcp), and in general, in any callback which provide an 
erro code (like recv_tcp)...
Frédéric BERNON 
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
Envoyé : jeudi 31 mai 2007 22:18
À : address@hidden
Objet : [lwip-devel] tcp_connect failure not calling connected callback

Hello all,

when tcp_connect is called the stack is supposed to
call the connected callback function with an error
code if the connection can not be made or is rst. at
least that's what it says in the rawapi.txt. instead
the errf callback is called. is the doc just out dated
or is this a mistake ?


 for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's 
economy) at Yahoo! Games. 

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

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf

reply via email to

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