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