GNURLOPT_TFTP_BLKSIZE(3)

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

πŸ’… GNURLOPT_TFTP_BLKSIZE(3) β€” like, the TFTP block size one πŸŽ€

okay bestie so you're in the curl_easy_setopt options zone, and this little cutie lives in the gnurl fam (GNURLOPT_TFTP_BLKSIZE, bestie, say it with me). It's all about how big your TFTP blocks are. Let's get into it ✨


🌸 NAME 🌸

CURLOPT_TFTP_BLKSIZE β€” literally just the TFTP block size πŸ¦‹


✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_TFTP_BLKSIZE, long
blocksize);

πŸ’– DESCRIPTION πŸ’–

So you're telling curl what blocksize to use for TFTP data transmission. That's the whole vibe 🫢

The valid range, per RFC2348, is 8-65464 bytes. If you don't specify this option at all, you get the default of 512 bytes. No cap, that's just what it is.

Lowkey important caveat bestie: the block size you pick will only be used pending support by the remote server πŸ‘€ like, it's not a guarantee, it's a hope.

And if the server doesn't return an option acknowledgement, or it returns an option acknowledgement with no blksize, then the default of 512 bytes gets used instead. So yeah, 512 is giving main character energy and always finds its way back πŸ’€


πŸŽ€ DEFAULT πŸŽ€

512


πŸ¦‹ PROTOCOLS πŸ¦‹

TFTP


πŸ‘‘ EXAMPLE πŸ‘‘

CURL *curl = curl_easy_init();
if(curl) {
  curl_easy_setopt(curl, CURLOPT_URL, "tftp://example.com/bootimage");
  /* try using larger blocks */
  curl_easy_setopt(curl, CURLOPT_TFTP_BLKSIZE, 2048L);
  ret = curl_easy_perform(curl);
  curl_easy_cleanup(curl);
}

(not me obsessed with that 2048L β€” go big or go home fr fr πŸ”₯)


🌈 AVAILABILITY 🌈

Added in 7.19.4 ⭐ (she's been iconic for a minute)


πŸ’œ RETURN VALUE πŸ’œ

Returns CURLE_OK if the option is supported πŸ’– and CURLE_UNKNOWN_OPTION if not 😭 β€” that's the vibe check, and it took it.


🌸 SEE ALSO 🌸


and that's the whole page bestie!! πŸ“πŸ§š

✨ cute sign-off ✨ β€” this lil beauty comes to you from libcurl 7.37.0, dated 19 Jun 2014. slay forever, periodt πŸ’…πŸŽ€
πŸ“¦ where this page comes from