CURLMOPT_NOTIFYDATA(3)
π CURLMOPT_NOTIFYDATA(3) π
ok so bestie, welcome to the Library Functions Manual β this one's a short one, but it's lowkey iconic. let's get into it β¨
πΈ NAME πΈ
CURLMOPT_NOTIFYDATA β the custom pointer you hand off to your notification callback. that's it. that's the vibe π«Ά
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_NOTIFYDATA, void *pointer);
like, one function call, one void *, no drama π
π DESCRIPTION π
so this is a data pointer that gets passed along to the notification callback β the one you set up with the CURLMOPT_NOTIFYFUNCTION(3) option. think of it as slipping your bestie a little note that says "hey, this is mine, use it" π
and listen β libcurl does not touch this pointer. like, at all. no peeking, no modifying, no main-character interference. it's literally just handed straight in as the notification callback's clientp argument. that's the whole job. iconic behavior honestly π
π¦ DEFAULT π¦
NULL
(yeah, it starts out empty β no pointer, no problem π)
πΌ PROTOCOLS πΌ
this functionality affects all supported protocols β every single one, fr fr π
β EXAMPLE β
ok here's the whole thing in action, copy it, love it, run it:
struct priv {
void *ours;
};
static void notify_cb(CURLM *multi, unsigned int notification,
CURL *easy, void *notifyp)
{
struct priv *p = notifyp;
printf("my ptr: %p\n", p->ours);
/* ... */
}
int main(void)
{
struct priv setup;
CURLM *multi = curl_multi_init();
/* ... use socket callback and custom pointer */
curl_multi_setopt(multi, CURLMOPT_NOTIFYFUNCTION, notify_cb);
curl_multi_setopt(multi, CURLMOPT_NOTIFYDATA, &setup);
curl_multi_notify_enable(multi, CURLMNOTIFY_INFO_READ);
}
see how &setup just slides right into notifyp? chef's kiss π§ no cap, that's the whole flow.
π AVAILABILITY π
added in curl 8.17.0 β so if your curl is older than that, bestie, it's giving "not yet" π go update π
π RETURN VALUE π
returns CURLM_OK. that's it. slay, no error codes to stress about π
π SEE ALSO π
go read those next, iykyk π
and that's the page, bestie π«Ά brought to you by libcurl, dated 2026-10-25 β mwah, go forth and notify π β¨
π¦ where this page comes from
- alpine 3.23: curl-doc 8.23.0-r0 Β· curl
- alpine 3.24: curl-doc 8.23.0-r0 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms