GNURLOPT_LOCALPORTRANGE(3)
hey bestie π welcome to GNURLOPT_LOCALPORTRANGE(3), aka one of the curl_easy_setopt options manual pages. This one is lowkey all about giving libcurl a range of local ports to try, and itβs short but mighty. π
π NAME π
CURLOPT_LOCALPORTRANGE β number of additional local ports to try. periodt. β¨
β¨ SYNOPSIS β¨
#include <gnurl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_LOCALPORTRANGE,
long range);
π¦ DESCRIPTION π¦
Okay so you pass a long, bestie. The range argument is literally the number of attempts libcurl will make to find a working local port number. It starts with the given CURLOPT_LOCALPORT(3) and adds one to the number for each retry. π
Setting this option to 1 or below will make libcurl do only one try for the exact port number β like, no extra chances, just the one vibe check. π Port numbers by nature are scarce resources that will be busy at times, so setting this value to something too low might cause unnecessary connection setup failures. ngl thatβs the important warning: too low = possible avoidable fail energy. π
π DEFAULT π
1 β thatβs the default, bestie. β¨
π PROTOCOLS π
All. every single one. slay. π
π EXAMPLE π
CURL *curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
curl_easy_setopt(curl, CURLOPT_LOCALPORT, 49152L);
/* and try 20 more ports following that */
curl_easy_setopt(curl, CURLOPT_LOCALPORTRANGE, 20L);
ret = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
π AVAILABILITY π
Added in 7.15.2. iconic old-school libcurl era. π«Ά
β RETURN VALUE β
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. fr fr, thatβs the whole return vibe. π
π«Ά SEE ALSO π«Ά
later, bestie π β this page comes from libcurl 7.37.0, dated 19 Jun 2014, and itβs the GNURLOPT_LOCALPORTRANGE(3) page. mwah πβ¨
π¦ where this page comes from
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms