cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker mailing list Archives

[ curl-Bugs-2616371 ] connect-timeout not working on Windows

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 20 Feb 2009 09:51:26 +0000

Bugs item #2616371, was opened at 2009-02-19 15:01
Message generated for change (Comment added) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2616371&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
>Category: libcurl
Group: portability problem
Status: Open
Resolution: None
>Priority: 3
Private: No
Submitted By: Erik Weidel (erikweidel)
>Assigned to: Daniel Stenberg (bagder)
Summary: connect-timeout not working on Windows

Initial Comment:
I have been playing around with curl and connection-timeouts on windows.
To test the connect-timeout, i used a second machine with linux and dropped all packets for the ftp port using iptables.
When i try to connect from my Windows XP SP3 box using
"curl.exe --connect-timeout 5 ftp://linuxbox", curl will hang forever.
When i use the "--max-time 5" option instead, it aborts after 5 seconds.

I have traced the packets on the linux box using tcpdump and could see three SYN-packets. The second was three seconds after the first and the third was six seconds after the second.
No more than three packets arrive, no matter how long the timeout is set.
This seems to be, because the windows default for retransmissions is "3" (found here: http://support.microsoft.com/?scid=kb%3Ben-us%3B175523&x=6&y=7 Option TcpMaxConnectRetransmissions)

So even with "--max-time 50", only three SYN-Packets are sent by the Windows TCP/IP stack. Therefore every timeout greater 20 seconds is useless with windows.

I have tried this with the last-curl version, i found:
curl 7.19.3 (i686-pc-mingw32) libcurl/7.19.3 OpenSSL/0.9.8j zlib/1.2.3 libidn/1.11 libssh2/1.0
Protocols: tftp ftp telnet dict ldap http file https ftps scp sftp
Features: IDN Largefile NTLM SSL libz

To summarize everything:
1. The connect-timeout does not work at all.
2. The max-time option works, but setting it to higher than 20 seconds is useless, because only three SYN-Packets are sent anyway with the default windows setting.

Let me clarify, that i am only talking about the connection phase!

----------------------------------------------------------------------

>Comment By: Daniel Stenberg (bagder)
Date: 2009-02-20 10:51

Message:
First, I know very little windows stuff so I've tried to get some help on
this by forwarding this bug report to the libcurl mailing list:
http://curl.haxx.se/mail/lib-2009-02/0225.html

I cannot understand how --max-time and --connect-timeout can differ for
this case since they do the same things internally until the connect
moment.

Regdarding the "TcpMaxConnectRetransmissions" that seems like a blatant
windows stupidity that I'm not sure is our business to bother about. We use
the TCP/IP stack as supposed and we do it the same for all platforms and if
Windows decide to cripple their approach how are we going to deal with
that?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=2616371&group_id=976
Received on 2009-02-20

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET