1CURLOPT_CONNECTTIMEOUT_MS(3)curl_easy_setopt optionsCURLOPT_CONNECTTIMEOUT_MS(3)
2
3
4
6 CURLOPT_CONNECTTIMEOUT_MS - timeout for the connect phase
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS,
12 long timeout);
13
15 Pass a long. It should contain the maximum time in milliseconds that
16 you allow the connection phase to the server to take. This only limits
17 the connection phase, it has no impact once it has connected. Set to
18 zero to switch to the default built-in connection timeout - 300 sec‐
19 onds. See also the CURLOPT_TIMEOUT_MS(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
28 300000
29
31 All
32
34 CURL *curl = curl_easy_init();
35 if(curl) {
36 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
37
38 /* complete connection within 10000 milliseconds */
39 curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
40
41 curl_easy_perform(curl);
42 }
43
45 Always
46
48 Returns CURLE_OK
49
51 CURLOPT_CONNECTTIMEOUT(3), CURLOPT_TIMEOUT(3), CUR‐
52 LOPT_LOW_SPEED_LIMIT(3),
53
54
55
56libcurl 7.85.0 May 17, 2022 CURLOPT_CONNECTTIMEOUT_MS(3)