1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_TIMEOUT_MS
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_CONNECTTIMEOUT (3)
9  - CURLOPT_LOW_SPEED_LIMIT (3)
10  - CURLOPT_TCP_KEEPALIVE (3)
11  - CURLOPT_TIMEOUT (3)
12---
13
14# NAME
15
16CURLOPT_TIMEOUT_MS - maximum time the transfer is allowed to complete
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT_MS, long timeout);
24~~~
25
26# DESCRIPTION
27
28Pass a long as parameter containing *timeout* - the maximum time in
29milliseconds that you allow the libcurl transfer operation to take.
30
31See CURLOPT_TIMEOUT(3) for details.
32
33# DEFAULT
34
35Default timeout is 0 (zero) which means it never times out during transfer.
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 within 20000 milliseconds */
51    curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 20000L);
52
53    curl_easy_perform(curl);
54  }
55}
56~~~
57
58# AVAILABILITY
59
60Always
61
62# RETURN VALUE
63
64Returns CURLE_OK
65