CURLOPT_PIPEWAIT.md (2040B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_PIPEWAIT 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLMOPT_MAX_HOST_CONNECTIONS (3) 9 - CURLMOPT_PIPELINING (3) 10 - CURLOPT_FORBID_REUSE (3) 11 - CURLOPT_FRESH_CONNECT (3) 12 Protocol: 13 - HTTP 14 Added-in: 7.43.0 15 --- 16 17 # NAME 18 19 CURLOPT_PIPEWAIT - wait for multiplexing 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PIPEWAIT, long wait); 27 ~~~ 28 29 # DESCRIPTION 30 31 Set *wait* to 1L to tell libcurl to prefer to wait for a connection to 32 confirm or deny that it can do multiplexing before continuing. 33 34 When about to perform a new transfer that allows multiplexing, libcurl checks 35 for existing connections to use. If no such connection exists it immediately 36 continues and creates a fresh new connection to use. 37 38 By setting this option to 1 - and having CURLMOPT_PIPELINING(3) enabled 39 for the multi handle this transfer is associated with - libcurl instead waits 40 for the connection to reveal if it is possible to multiplex on before it 41 continues. This enables libcurl to much better keep the number of connections 42 to a minimum when using multiplexing protocols. 43 44 With this option set, libcurl prefers to wait and reuse an existing connection 45 for multiplexing rather than the opposite: prefer to open a new connection 46 rather than waiting. 47 48 The waiting time is as long as it takes for the connection to get up and for 49 libcurl to get the necessary response back that informs it about its protocol 50 and support level. 51 52 # DEFAULT 53 54 0 (off) 55 56 # %PROTOCOLS% 57 58 # EXAMPLE 59 60 ~~~c 61 int main(void) 62 { 63 CURL *curl = curl_easy_init(); 64 if(curl) { 65 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 66 curl_easy_setopt(curl, CURLOPT_PIPEWAIT, 1L); 67 68 /* now add this easy handle to the multi handle */ 69 } 70 } 71 ~~~ 72 73 # %AVAILABILITY% 74 75 # RETURN VALUE 76 77 curl_easy_setopt(3) returns a CURLcode indicating success or error. 78 79 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 80 libcurl-errors(3).