GNURLOPT_TCP_FASTOPEN(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

✨ NAME ✨

Okay so this is the GNURLOPT_TCP_FASTOPEN(3) manual page, and it's all about CURLOPT_TCP_FASTOPEN β€” the option that enables TCP Fast Open. Periodt. πŸ’…


🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TCP_FASTOPEN, long
       enable);

πŸ¦‹ DESCRIPTION πŸ¦‹

You pass a long as the parameter, and you set it to 1L to enable or 0 to disable. That's the whole vibe. ✨

TCP Fast Open (RFC7413) is literally a mechanism that allows data to be carried in the SYN and SYN-ACK packets and consumed by the receiving end during the initial connection handshake. The glow-up? It saves up to one full round-trip time (RTT). No cap. πŸ”₯


πŸŽ€ DEFAULT πŸŽ€

The default is 0. So it's off unless you turn it on, bestie β€” you gotta opt in. πŸ’€


🌈 PROTOCOLS 🌈

All. Every protocol, no gatekeeping. 🫢


πŸ‘‘ EXAMPLE πŸ‘‘

Here's the whole vibe in code β€” keep it exactly like this, okay? πŸ“

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
  curl_easy_perform(curl);
}

🧚 AVAILABILITY 🧚

Added in 7.49.0. This option is currently only supported on Linux and OS X El Capitan β€” yes, specifically El Capitan, iykyk. πŸ“


πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if fast open is supported by the operating system, otherwise returns CURLE_NOT_BUILT_IN. No in-between, bestie. πŸ’€


k bye bestie! 🫢 this page came from libcurl 7.49.0, dated 16 Feb 2016, and it's the GNURLOPT_TCP_FASTOPEN(3) page β€” mwah πŸ’‹

πŸ“¦ where this page comes from