1CURLOPT_UPKEEP_INTERVAL_MS(3c)url_easy_setopt optionCsURLOPT_UPKEEP_INTERVAL_MS(3)
2
3
4

NAME

6       CURLOPT_UPKEEP_INTERVAL_MS - connection upkeep interval
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPKEEP_INTERVAL_MS,
12                                 long upkeep_interval_ms);
13

DESCRIPTION

15       Some  protocols  have  "connection upkeep" mechanisms. These mechanisms
16       usually send some traffic on existing connections in order to keep them
17       alive;  this can prevent connections from being closed due to overzeal‐
18       ous firewalls, for example.
19
20       The user needs to explicitly call curl_easy_upkeep(3) in order to  per‐
21       form the upkeep work.
22
23       Currently  the  only  protocol  with  a  connection upkeep mechanism is
24       HTTP/2:  when  the  connection  upkeep   interval   is   exceeded   and
25       curl_easy_upkeep(3) is called, an HTTP/2 PING frame is sent on the con‐
26       nection.
27
28

DEFAULT

30       CURL_UPKEEP_INTERVAL_DEFAULT (currently defined as 60000L, which is  60
31       seconds)
32

PROTOCOLS

34       All
35

EXAMPLE

37       CURL *curl = curl_easy_init();
38       if(curl) {
39         /* Make a connection to an HTTP/2 server. */
40         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
41
42         /* Set the interval to 30000ms / 30s */
43         curl_easy_setopt(curl, CURLOPT_UPKEEP_INTERVAL_MS, 30000L);
44
45         curl_easy_perform(curl);
46
47         /* Perform more work here. */
48
49         /* While the connection is being held open, curl_easy_upkeep() can be
50            called. If curl_easy_upkeep() is called and the time since the last
51            upkeep exceeds the interval, then an HTTP/2 PING is sent. */
52         curl_easy_upkeep(curl);
53
54         /* Perform more work here. */
55
56         /* always cleanup */
57         curl_easy_cleanup(curl);
58       }
59

AVAILABILITY

61       Added in 7.62.0
62

RETURN VALUE

64       Returns CURLE_OK
65

SEE ALSO

67       CURLOPT_TCP_KEEPALIVE(3),
68
69
70
71
72libcurl 8.0.1                  January 02, 2023  CURLOPT_UPKEEP_INTERVAL_MS(3)
Impressum