1CURLOPT_CONNECTTIMEOUT(3)  curl_easy_setopt options  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
12       timeout);
13

DESCRIPTION

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

DEFAULT

28       300
29

PROTOCOLS

31       All
32

EXAMPLE

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

AVAILABILITY

45       Always
46

RETURN VALUE

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

SEE ALSO

52       CURLOPT_CONNECTTIMEOUT_MS(3),          CURLOPT_TIMEOUT(3),         CUR‐
53       LOPT_LOW_SPEED_LIMIT(3),
54
55
56
57libcurl 7.66.0                 October 03, 2017      CURLOPT_CONNECTTIMEOUT(3)
Impressum