GNURLMOPT...ONNECTIONS(3)

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

πŸ’… GNURLMOPT_MAX_TOTAL_CONNECTIONS(3) β€” curl_multi_setopt options

okay bestie, listen β€” this is the gnurl flavor of the curl_multi_setopt options page, and today's main character is CURLMOPT_MAX_TOTAL_CONNECTIONS. she's the bouncer at the club door of your multi handle and she will count everyone. no cap. πŸŽ€


✨ NAME ✨

CURLMOPT_MAX_TOTAL_CONNECTIONS β€” the max number of simultaneously open connections, like, total. not per host, not per vibe, total. πŸ’…


🌸 SYNOPSIS 🌸

#include <gnurl/curl.h>

CURLMcode curl_multi_setopt(CURLM *handle,
CURLMOPT_MAX_TOTAL_CONNECTIONS, long amount);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so you pass a long in as the amount, right? that number becomes the maximum number of simultaneously open connections in total using this multi handle. literally the whole squad, one cap. πŸ‘‘

so for every new session, libcurl opens a new connection β€” but only up to the limit you set with CURLMOPT_MAX_TOTAL_CONNECTIONS(3). once you hit that limit? the sessions just... wait. pending. hanging out in the group chat until a connection frees up. 😭 no cutting the line, bestie.

and if CURLMOPT_PIPELINING(3) is enabled, libcurl will try to pipeline or use multiplexing if the host is capable of it β€” like carpooling to the function instead of everyone driving separately. iconic behavior honestly. πŸš—βœ¨


πŸ’œ DEFAULT πŸ’œ

the default value is 0, which means there is no limit. ngl, wild. in that case it's simply controlled by the number of easy handles you added β€” so the easy handles are running the show. main character energy from them, I guess. πŸ™ˆ


🌈 PROTOCOLS 🌈

All β€” every single one. she's versatile like that. ⭐


πŸ’– EXAMPLE πŸ’–

CURLM *m = curl_multi_init();
/* never do more than 15 connections */
curl_multi_setopt(m, CURLMOPT_MAX_TOTAL_CONNECTIONS, 15L);

see that? fifteen. that's the ceiling. the whole squad of 15 and not one more, periodt. πŸ”₯


πŸŽ€ AVAILABILITY πŸŽ€

Added in 7.30.0 β€” she's been serving since then, iykyk. πŸ’«


πŸ‘‘ RETURN VALUE πŸ‘‘

returns CURLM_OK if the option is supported β€” slay, we're so back β€” and CURLM_UNKNOWN_OPTION if it's not. πŸ˜­πŸ’€

lowkey important: CURLM_UNKNOWN_OPTION is your sign that this build just doesn't know her. don't take it personally, bestie. 🫢

πŸ”₯ SEE ALSO πŸ”₯


that's the whole page, bestie β€” go forth and cap your connections responsibly πŸ’œβœ¨

libcurl 7.39.0 Β· 4 Nov 2014 β€” yeah that's the version and date down at the bottom, mwah, bye! πŸ“πŸ§š

πŸ“¦ where this page comes from