1CURLMOPT_SOCKETDATA(3)     curl_multi_setopt options    CURLMOPT_SOCKETDATA(3)
2
3
4

NAME

6       CURLMOPT_SOCKETDATA - custom pointer passed to the socket callback
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETDATA, void *pointer);
12

DESCRIPTION

14       A  data  pointer  to  pass  to  the  socket callback set with the CURL‐
15       MOPT_SOCKETFUNCTION(3) option.
16
17       This pointer will not be touched by libcurl but will only be passed  in
18       to the socket callbacks's userp argument.
19

DEFAULT

21       NULL
22

PROTOCOLS

24       All
25

EXAMPLE

27       static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
28       {
29         GlobalInfo *g = (GlobalInfo*) cbp;
30         SockInfo *fdp = (SockInfo*) sockp;
31
32         if(what == CURL_POLL_REMOVE) {
33           remsock(fdp);
34         }
35         else {
36           if(!fdp) {
37             addsock(s, e, what, g);
38           }
39           else {
40             setsock(fdp, s, e, what, g);
41           }
42         }
43         return 0;
44       }
45
46       main()
47       {
48         GlobalInfo setup;
49         /* ... use socket callback and custom pointer */
50         curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb);
51         curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, &setup);
52       }
53

AVAILABILITY

55       Added in 7.15.4
56

RETURN VALUE

58       Returns CURLM_OK.
59

SEE ALSO

61       CURLMOPT_SOCKETFUNCTION(3),      curl_multi_socket_action(3),     CURL‐
62       MOPT_TIMERFUNCTION(3)
63
64
65
66libcurl 7.64.0                   May 31, 2017           CURLMOPT_SOCKETDATA(3)
Impressum