1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_CONNECTTIMEOUT_MS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CONNECTTIMEOUT (3)
9  - CURLOPT_LOW_SPEED_LIMIT (3)
10  - CURLOPT_TIMEOUT (3)
11Protocol:
12  - All
13---
14
15# NAME
16
17CURLOPT_CONNECTTIMEOUT_MS - timeout for the connect phase
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CONNECTTIMEOUT_MS,
25                          long timeout);
26~~~
27
28# DESCRIPTION
29
30Pass a long. It should contain the maximum time in milliseconds that you allow
31the connection phase to the server to take.
32
33See CURLOPT_CONNECTTIMEOUT(3) for details.
34
35# DEFAULT
36
37300000
38
39# EXAMPLE
40
41~~~c
42int main(void)
43{
44  CURL *curl = curl_easy_init();
45  if(curl) {
46    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
47
48    /* complete connection within 10000 milliseconds */
49    curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, 10000L);
50
51    curl_easy_perform(curl);
52  }
53}
54~~~
55
56# AVAILABILITY
57
58Always
59
60# RETURN VALUE
61
62Returns CURLE_OK
63