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
14Added-in: 7.16.2
15---
16
17# NAME
18
19CURLOPT_TIMEOUT_MS - maximum time the transfer is allowed to complete
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TIMEOUT_MS, long timeout);
27~~~
28
29# DESCRIPTION
30
31Pass a long as parameter containing *timeout* - the maximum time in
32milliseconds that you allow the libcurl transfer operation to take.
33
34See CURLOPT_TIMEOUT(3) for details.
35
36# DEFAULT
37
380 (zero) which means it never times out during transfer.
39
40# %PROTOCOLS%
41
42# EXAMPLE
43
44~~~c
45int main(void)
46{
47  CURL *curl = curl_easy_init();
48  if(curl) {
49    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
50
51    /* complete within 20000 milliseconds */
52    curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 20000L);
53
54    curl_easy_perform(curl);
55  }
56}
57~~~
58
59# %AVAILABILITY%
60
61# RETURN VALUE
62
63Returns CURLE_OK
64