cURL / Mailing Lists / curl-library / Single Mail


multi interface doesn't recognize when can't connect

From: Martin C. Martin <>
Date: Sun, 09 Feb 2003 16:39:04 -0500

Hi all,

I'm using libcURL 7.10.3 with Microsoft Visual C++ under windows. With
the Easy interface, everything is just fine, but when I try to connect to
a port that doesn't have a server, I never get an error message. For
example, I don't have a web server on my machine, so an attempt to connect
to should fail but doesn't. I've tracked down the
problem, it goes like this:

The third call to curl_multi_perform() is the first time it's in
CURLM_STATE_WAITCONNECT, and it calls Curl_is_connected(), which calls
waitconnect(). The comments for waitconnect() say:

* Return 0 on fine connect, -1 on error and 1 on timeout.

But in reality, if select() leaves the file descriptor in the list of
error descriptors, waitconnect() returns 2. This is happening to me on
Windows/MSVC when there's nothing to connect to. Curl_is_connected()
ignores this return value (along with -1 and 1) and seems to assume its
still connecting.

So, if I understand correctly, after the "if (0 == rc)" there should be an
"else if (rc != 1) return CURLE_COULDNT_CONNECT;" But, I'm not really a
network programmer so I leave the fix to you.

- Martin

This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
Received on 2003-02-09