Annotation of embedaddon/curl/docs/libcurl/opts/CURLMOPT_SOCKETDATA.3, revision 1.1.1.1

1.1       misho       1: .\" **************************************************************************
                      2: .\" *                                  _   _ ____  _
                      3: .\" *  Project                     ___| | | |  _ \| |
                      4: .\" *                             / __| | | | |_) | |
                      5: .\" *                            | (__| |_| |  _ <| |___
                      6: .\" *                             \___|\___/|_| \_\_____|
                      7: .\" *
                      8: .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
                      9: .\" *
                     10: .\" * This software is licensed as described in the file COPYING, which
                     11: .\" * you should have received as part of this distribution. The terms
                     12: .\" * are also available at https://curl.haxx.se/docs/copyright.html.
                     13: .\" *
                     14: .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
                     15: .\" * copies of the Software, and permit persons to whom the Software is
                     16: .\" * furnished to do so, under the terms of the COPYING file.
                     17: .\" *
                     18: .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
                     19: .\" * KIND, either express or implied.
                     20: .\" *
                     21: .\" **************************************************************************
                     22: .\"
                     23: .TH CURLMOPT_SOCKETDATA 3 "May 31, 2017" "libcurl 7.70.0" "curl_multi_setopt options"
                     24: 
                     25: .SH NAME
                     26: CURLMOPT_SOCKETDATA \- custom pointer passed to the socket callback
                     27: .SH SYNOPSIS
                     28: .nf
                     29: #include <curl/curl.h>
                     30: 
                     31: CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETDATA, void *pointer);
                     32: .SH DESCRIPTION
                     33: A data \fIpointer\fP to pass to the socket callback set with the
                     34: \fICURLMOPT_SOCKETFUNCTION(3)\fP option.
                     35: 
                     36: This pointer will not be touched by libcurl but will only be passed in to the
                     37: socket callbacks's \fBuserp\fP argument.
                     38: .SH DEFAULT
                     39: NULL
                     40: .SH PROTOCOLS
                     41: All
                     42: .SH EXAMPLE
                     43: .nf
                     44: static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp)
                     45: {
                     46:   GlobalInfo *g = (GlobalInfo*) cbp;
                     47:   SockInfo *fdp = (SockInfo*) sockp;
                     48: 
                     49:   if(what == CURL_POLL_REMOVE) {
                     50:     remsock(fdp);
                     51:   }
                     52:   else {
                     53:     if(!fdp) {
                     54:       addsock(s, e, what, g);
                     55:     }
                     56:     else {
                     57:       setsock(fdp, s, e, what, g);
                     58:     }
                     59:   }
                     60:   return 0;
                     61: }
                     62: 
                     63: main()
                     64: {
                     65:   GlobalInfo setup;
                     66:   /* ... use socket callback and custom pointer */
                     67:   curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb);
                     68:   curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, &setup);
                     69: }
                     70: .fi
                     71: .SH AVAILABILITY
                     72: Added in 7.15.4
                     73: .SH RETURN VALUE
                     74: Returns CURLM_OK.
                     75: .SH "SEE ALSO"
                     76: .BR CURLMOPT_SOCKETFUNCTION "(3), " curl_multi_socket_action "(3), "
                     77: .BR CURLMOPT_TIMERFUNCTION "(3) "

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>