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