1CURLOPT_CONNECTTIMEOUT(3)           libcurl          CURLOPT_CONNECTTIMEOUT(3)
2
3
4

NAME

6       CURLOPT_CONNECTTIMEOUT - timeout for the connect phase
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT, long timeout);
12

DESCRIPTION

14       Pass a long. It should contain the maximum time in seconds that you al‐
15       low the connection phase to the server to take.  This only  limits  the
16       connection  phase,  it has no impact once it has connected. Set to zero
17       to switch to the default built-in connection timeout - 300 seconds. See
18       also the CURLOPT_TIMEOUT(3) option.
19
20       In  unix-like  systems, this might cause signals to be used unless CUR‐
21       LOPT_NOSIGNAL(3) is set.
22
23       If both CURLOPT_CONNECTTIMEOUT(3) and CURLOPT_CONNECTTIMEOUT_MS(3)  are
24       set, the value set last will be used.
25
26       The  "connection  phase" is considered complete when the requested TCP,
27       TLS or QUIC handshakes are done.
28

DEFAULT

30       300
31

PROTOCOLS

33       All
34

EXAMPLE

36       CURL *curl = curl_easy_init();
37       if(curl) {
38         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
39
40         /* complete connection within 10 seconds */
41         curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
42
43         curl_easy_perform(curl);
44       }
45

AVAILABILITY

47       Always
48

RETURN VALUE

50       Returns CURLE_OK. Returns CURLE_BAD_FUNCTION_ARGUMENT if set to a nega‐
51       tive value or a value that when converted to milliseconds is too large.
52

SEE ALSO

54       CURLOPT_CONNECTTIMEOUT_MS(3),          CURLOPT_TIMEOUT(3),         CUR‐
55       LOPT_LOW_SPEED_LIMIT(3),
56
57
58
59ibcurl 8.2.1                    April 26, 2023       CURLOPT_CONNECTTIMEOUT(3)
Impressum