1CURLOPT_CONNECTTIMEOUT_MS(3) libcurl CURLOPT_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
27 The "connection phase" is considered complete when the requested TCP,
28 TLS or QUIC handshakes are done.
29
31 300000
32
34 All
35
37 CURL *curl = curl_easy_init();
38 if(curl) {
39 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
40
41 /* complete connection within 10000 milliseconds */
42 curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
43
44 curl_easy_perform(curl);
45 }
46
48 Always
49
51 Returns CURLE_OK
52
54 CURLOPT_CONNECTTIMEOUT(3), CURLOPT_TIMEOUT(3), CUR‐
55 LOPT_LOW_SPEED_LIMIT(3),
56
57
58
59ibcurl 8.2.1 April 26, 2023 CURLOPT_CONNECTTIMEOUT_MS(3)