|
From: | Alain M. |
Subject: | Re: [lwip-users] Is connect blocking?? was :How we can set timeout in blocking socket |
Date: | Fri, 13 Mar 2009 23:37:54 -0300 |
User-agent: | Thunderbird 2.0.0.17 (X11/20080914) |
I found this old message... Please see below Kieran Mansley escreveu:
On Wed, 2008-12-03 at 22:15 +0800, yueyue papa wrote:I am confusedYou can use the SO_RCVTIMEO socket option to set the recv()operation's timeout it means I could set receive timeout for receive timeout, but I could not use it for connect timeout. Am I right?So write is is not time out, Listen is no timeoutThat is correct. listen() is not normally a blocking call anyway. recv() can time out if you set SO_RCVTIMEO accept() will also time out if you set SO_RCVTIMEO connect() and write() would need support for SO_CONTIMEO and SO_SNDTIMEO which are not implemented (yet) in lwIP.
So, is it possible that connect() and write() block and never return?Is it possible to make these functions to abort setting some flag from another thread, or in any other way? (I am using lwip with FreeRTOS)
My problem is that if I try to connect to a server that does not exist, I need to stop trying after some time and connect to the backup server...
Are there any docs about this? I checkd the wiki, but only found external links. I am looking for lwip specific info... ( checked socket.c but could not understand some of it):
connect() calls lwip_connect(), then netconn_connect(), then tcpip_apimsg() with function=do_connect, then do_connect(), then tcp_connect(), then I got lost :(
Thanks for any help, Alain
[Prev in Thread] | Current Thread | [Next in Thread] |