1curl_easy_upkeep(3)             libcurl Manual             curl_easy_upkeep(3)
2
3
4

NAME

6       curl_easy_upkeep - Perform any connection upkeep checks.
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_upkeep(CURL *handle);
12

DESCRIPTION

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

EXAMPLE

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

AVAILABILITY

53       Added in 7.62.0.
54

RETURN VALUE

56       On success, returns CURLE_OK.
57
58       On failure, returns the appropriate error code.
59

SEE ALSO

61       CURLOPT_TCP_KEEPALIVE(3), CURLOPT_TCP_KEEPIDLE(3),
62
63
64
65libcurl 8.0.1                  January 02, 2023            curl_easy_upkeep(3)
Impressum