GNURLOPT_CLOSESOCKETDATA(3)

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

πŸ’– GNURLOPT_CLOSESOCKETDATA(3) πŸ’–

okay so bestie, welcome to this page from the curl_easy_setopt options manual β€” we're talking about CURLOPT_CLOSESOCKETDATA, and it's lowkey a tiny little handoff situation πŸ’…βœ¨

🌸 NAME 🌸

CURLOPT_CLOSESOCKETDATA β€” pointer passed to the socket close callback 🫢

πŸŽ€ SYNOPSIS πŸŽ€

#include <gnurl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CLOSESOCKETDATA, void
*pointer);

✨ DESCRIPTION ✨

You pass in a pointer, and libcurl literally leaves it untouched β€” no peeking, no vibes-checking, nothing. It just gets passed along as the first argument in the closesocket callback that you set with CURLOPT_CLOSESOCKETFUNCTION(3) πŸ’–

Think of it as the little bag you hand over and say β€œhold this for me,” except libcurl is a very polite bestie and does not open it πŸŽ€

πŸ¦‹ DEFAULT πŸ¦‹

The default value of this parameter is NULL. periodt πŸ’€

🌈 PROTOCOLS 🌈

All except file: β€” no cap, that's the whole list 🧚

πŸ’œ EXAMPLE πŸ’œ

static int closesocket(void *clientp, curl_socket_t item)
{
  printf("libcurl wants to close %d now\n", (int)item);
  return 0;
}

/* call this function to close sockets */
curl_easy_setopt(curl, CURLOPT_CLOSESOCKETFUNCTION, closesocket);
curl_easy_setopt(curl, CURLOPT_CLOSESOCKETDATA, &sockfd);

⭐ AVAILABILITY ⭐

Added in 7.21.7 β€” iconic behavior since way back πŸ‘‘

πŸ”₯ RETURN VALUE πŸ”₯

Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. fr fr 😭

πŸ‘€ SEE ALSO πŸ‘€


okay that's the whole vibe, bestie β€” this page is from libcurl 7.37.0, dated 16 Jun 2014, signed off as GNURLOPT_CLOSESOCKETDATA(3) πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from