curl_easy_upkeep.3
imports <curl/curl.h>Uses libcurl for HTTP communication
SHA-256013a3d633585f73dcc1aa67ee7ef1f390a8c0599755b2434c0f7f1583322e15f
MaleculeH(Cm)Md(In)
Evidence
⋯4 lines
5.SH SYNOPSIS
6.nf
7#include <curl/curl.h>
8
9CURLcode curl_easy_upkeep(CURL *handle);
10.fi
11.SH DESCRIPTION
12Some protocols have "connection upkeep" mechanisms. These mechanisms usually
13send some traffic on existing connections in order to keep them alive; this
14can prevent connections from being closed due to overzealous firewalls, for
15example.
16
17For HTTP/2 we have an upkeep mechanism: when
18the connection upkeep interval is exceeded and \fIcurl_easy_upkeep(3)\fP
19is called, an HTTP/2 PING frame is sent on the connection.
20
21For MQTT …
24:68… eep work.
25The connection upkeep interval is set with
26\fICURLOPT_UPKEEP_INTERVAL_MS(3)\fP.
27
28If you call this function on an easy handle that uses a shared connection cache
29then upkeep is performed on the connections in that cache, even …
32:36… orted protocols
33.SH EXAMPLE
34.nf
35int main(void)
36{
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 cal …
54 /* Perform more work here. */
55
56 /* always cleanup */
57 curl_easy_cleanup(curl);
58 }
59}
⋯5 lines
67:9… rl\-errors(3)\fP. If \fICURLOPT_ERRORBUFFER(3)\fP was set with \fIcurl_easy_setopt(3)\fP
68there can be an error message stored in the error buffer when non\-zero is
69returned.
70.SH SEE ALSO
71.BR CURLOPT_TCP_KEEPALI …