CURLOPT_TCP_FASTOPEN.md (1390B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_TCP_FASTOPEN 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_SSL_FALSESTART (3) 9 Protocol: 10 - TCP 11 Added-in: 7.49.0 12 --- 13 14 # NAME 15 16 CURLOPT_TCP_FASTOPEN - TCP Fast Open 17 18 # SYNOPSIS 19 20 ~~~c 21 #include <curl/curl.h> 22 23 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long enable); 24 ~~~ 25 26 # DESCRIPTION 27 28 Pass a long as parameter set to 1L to enable or 0 to disable. 29 30 TCP Fast Open (RFC 7413) is a mechanism that allows data to be carried in the 31 SYN and SYN-ACK packets and consumed by the receiving end during the initial 32 connection handshake, saving up to one full round-trip time (RTT). 33 34 Beware: the TLS session cache does not work when TCP Fast Open is enabled. TCP 35 Fast Open is also known to be problematic on or across certain networks. 36 37 # DEFAULT 38 39 0 40 41 # %PROTOCOLS% 42 43 # EXAMPLE 44 45 ~~~c 46 int main(void) 47 { 48 CURL *curl = curl_easy_init(); 49 if(curl) { 50 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 51 curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L); 52 curl_easy_perform(curl); 53 } 54 } 55 ~~~ 56 57 # NOTES 58 59 This option is only supported on Linux and macOS 10.11 or later. 60 61 # %AVAILABILITY% 62 63 # RETURN VALUE 64 65 curl_easy_setopt(3) returns a CURLcode indicating success or error. 66 67 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 68 libcurl-errors(3).