GNURLOPT_CLOSESOCKETDATA(3)
π 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 π
CURLOPT_CLOSESOCKETFUNCTION(3),CURLOPT_OPENSOCKETFUNCTION(3), β the whole squad, iykyk π«Ά
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
- nixos 26.05: libgnurl 7.72.0
- nixpkgs unstable: libgnurl 7.72.0
- Copyright (C) 1998 - 2020, 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