CURLOPT_TCP_FASTOPEN(3)
π CURLOPT_TCP_FASTOPEN(3) π
okay so we're in the Library Functions Manual, bestie, and today's main character is CURLOPT_TCP_FASTOPEN β the option that literally skips a whole round-trip like it's running late for class. β¨
πΈ NAME πΈ
CURLOPT_TCP_FASTOPEN β TCP Fast Open, no cap π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long enable);
π DESCRIPTION π
So you pass a long as the parameter, and it's so simple: set it to 1L to turn it on, or 0 to turn it off. that's the whole vibe check. π«Ά
TCP Fast Open (RFC 7413) is this iconic mechanism where data just... rides along inside the SYN and SYN-ACK packets, and the receiving end consumes it during the initial connection handshake. the result? it saves up to one full round-trip time (RTT). one. whole. RTT. that's giving main character energy honestly. β
β οΈ Beware, bestie: the TLS session cache does not work when TCP Fast Open is enabled. like, at all. π and TCP Fast Open is also known to be problematic on or across certain networks. so like... know before you go. π
π DEFAULT π
0
(off by default β she's lowkey until you tell her otherwise)
π PROTOCOLS π
This functionality affects tcp only. that's it. that's the whole list. periodt. π
β¨ EXAMPLE β¨
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
curl_easy_perform(curl);
}
}
look at her go π₯
π§ NOTES π§
This option is only supported on Linux and macOS 10.11 or later. so if you're on something elseβ¦ not me being unsupported π
π AVAILABILITY π
Added in curl 7.49.0 β a classic, honestly. π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK β slay. non-zero means an error occurred, so go check libcurl-errors(3) and figure out what went wrong, iykyk. π
πΈ SEE ALSO πΈ
CURLOPT_SSL_FALSESTART(3)β her cousin, also doing too much with the handshake π¦
and that's the page, bestie!! π this one came from the libcurl crew, dated 2026-10-12 β mwah, kisses, go forth and fast-open responsibly. ππ π«Ά
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms