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