The only way I know is to put the socket into non-blocking mode, use select() and then put it back into blocking mode once connected.

Just out of interest why do you want to use blocking sockets?

On 23/09/2012 8:22 AM, Charles Mills wrote:
X-posted to IBMTCP, MVS-OE, and IBMMAIN.

I asked this question on the TCP/IP list on Thursday and have gotten no
informative replies.

I've since figured out that I can control the send() timeout with
setsockopt(socket, SOL_SOCKET, SO_SNDTIMEO, &timeval, sizeof(timeval));

But does anyone know how to control how long a connect() retries? I've since
read about the logic -- send a SYN, wait three seconds, send a SYN, wait six
(or nine) seconds, etc. But is there any programmatic way to tell TCP/IP to
give up in less than three minutes?

Thanks,

Charles

-----Original Message-----
From: IBM TCP/IP List [mailto:ibmtc...@vm.marist.edu] On Behalf Of Charles
Mills
Sent: Thursday, September 20, 2012 12:36 PM
To: ibmtc...@vm.marist.edu
Subject: Controlling send() and connect() timeouts?

I notice that connect() takes three minutes to return if the IP address does
not reference an appropriate server, or if the server does not have an
appropriate listen() pending. In testing, send() has taken as long as 8
minutes to return with an error when the server "goes away."

Short of going to non-blocking sockets, is there a way to control these
timeouts?

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to