cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_CONNECTTIMEOUT and

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 26 Jan 2004 18:51:45 +0100 (CET)

On Mon, 26 Jan 2004, Jerry G. Chiuan wrote:

> > CURLOPT_TIMEOUT sets a timeout for the entire transfer, so if the transfer
> > is still in progress when the timer times out, the the transfer is
> > aborted.
>
> what you mean by *entire* transfer, it includes connect, read/write, and
> close, right?

Correct.

> So without using signal/alarm( ), curl timeout options *still* relies on
> system calls, right?

Only one system call to be exact.

> but, I am still courious how curl enables timeout without using signal?,
> e.g. for UNIX multi-threaded program, using select( )?

libcurl uses everything non-blocking that it can. This way libcurl waits for
the connects and can easily timeout when the timeout is reached.

Name resolution can't be made non-blocking using the standard API, that's why
we depend on ares for that.

> > In what way is the IP "invalid" ? If that is a slow name lookup happening,
> > then there's the limits as explained above.
>
> invalid IP means there is no machine w/ that IP fundementally, it is not
> about name lookup
>
> > If not, then CURLOPT_CONNECTTIMEOUT should time-out the operation.
>
> I think so, but it does NOT happen however, it times out after I use
> CURLOPT_CONNECT, I don't know why CURLOPT_CONNECT can do that but
> CURLOPT_CONNECTTIMEOUT can't there should not be any difference since it is
> in connection phase

It smells like there might be a bug in there.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
Received on 2004-01-26