Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/curl/docs/libcurl/opts/CURLMOPT_SOCKETFUNCTION.3 @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 .\" ************************************************************************** | |
| 2 .\" * _ _ ____ _ | |
| 3 .\" * Project ___| | | | _ \| | | |
| 4 .\" * / __| | | | |_) | | | |
| 5 .\" * | (__| |_| | _ <| |___ | |
| 6 .\" * \___|\___/|_| \_\_____| | |
| 7 .\" * | |
| 8 .\" * Copyright (C) 1998 - 2019, 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_SOCKETFUNCTION 3 "3 Nov 2016" "libcurl 7.39.0" "curl_multi_setopt options" | |
| 24 .SH NAME | |
| 25 CURLMOPT_SOCKETFUNCTION \- callback informed about what to wait for | |
| 26 .SH SYNOPSIS | |
| 27 .nf | |
| 28 #include <curl/curl.h> | |
| 29 | |
| 30 int socket_callback(CURL *easy, /* easy handle */ | |
| 31 curl_socket_t s, /* socket */ | |
| 32 int what, /* describes the socket */ | |
| 33 void *userp, /* private callback pointer */ | |
| 34 void *socketp); /* private socket pointer */ | |
| 35 | |
| 36 CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_SOCKETFUNCTION, socket_callback); | |
| 37 .SH DESCRIPTION | |
| 38 Pass a pointer to your callback function, which should match the prototype | |
| 39 shown above. | |
| 40 | |
| 41 When the \fIcurl_multi_socket_action(3)\fP function is called, it informs the | |
| 42 application about updates in the socket (file descriptor) status by doing | |
| 43 none, one, or multiple calls to the \fBsocket_callback\fP. The callback | |
| 44 function gets status updates with changes since the previous time the callback | |
| 45 was called. If the given callback pointer is set to NULL, no callback will be | |
| 46 called. | |
| 47 .SH "CALLBACK ARGUMENTS" | |
| 48 \fIeasy\fP identifies the specific transfer for which this update is related. | |
| 49 | |
| 50 \fIs\fP is the specific socket this function invocation concerns. If the | |
| 51 \fBwhat\fP argument is not CURL_POLL_REMOVE then it holds information about | |
| 52 what activity on this socket the application is supposed to | |
| 53 monitor. Subsequent calls to this callback might update the \fBwhat\fP bits | |
| 54 for a socket that is already monitored. | |
| 55 | |
| 56 \fBuserp\fP is set with \fICURLMOPT_SOCKETDATA(3)\fP. | |
| 57 | |
| 58 \fBsocketp\fP is set with \fIcurl_multi_assign(3)\fP or will be NULL. | |
| 59 | |
| 60 The \fBwhat\fP parameter informs the callback on the status of the given | |
| 61 socket. It can hold one of these values: | |
| 62 .IP CURL_POLL_IN | |
| 63 Wait for incoming data. For the socket to become readable. | |
| 64 .IP CURL_POLL_OUT | |
| 65 Wait for outgoing data. For the socket to become writable. | |
| 66 .IP CURL_POLL_INOUT | |
| 67 Wait for incoming and outgoing data. For the socket to become readable or | |
| 68 writable. | |
| 69 .IP CURL_POLL_REMOVE | |
| 70 The specified socket/file descriptor is no longer used by libcurl. | |
| 71 .SH DEFAULT | |
| 72 NULL (no callback) | |
| 73 .SH PROTOCOLS | |
| 74 All | |
| 75 .SH EXAMPLE | |
| 76 .nf | |
| 77 static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp) | |
| 78 { | |
| 79 GlobalInfo *g = (GlobalInfo*) cbp; | |
| 80 SockInfo *fdp = (SockInfo*) sockp; | |
| 81 | |
| 82 if(what == CURL_POLL_REMOVE) { | |
| 83 remsock(fdp); | |
| 84 } | |
| 85 else { | |
| 86 if(!fdp) { | |
| 87 addsock(s, e, what, g); | |
| 88 } | |
| 89 else { | |
| 90 setsock(fdp, s, e, what, g); | |
| 91 } | |
| 92 } | |
| 93 return 0; | |
| 94 } | |
| 95 | |
| 96 main() | |
| 97 { | |
| 98 GlobalInfo setup; | |
| 99 /* ... use socket callback and custom pointer */ | |
| 100 curl_multi_setopt(multi, CURLMOPT_SOCKETFUNCTION, sock_cb); | |
| 101 curl_multi_setopt(multi, CURLMOPT_SOCKETDATA, &setup); | |
| 102 } | |
| 103 .fi | |
| 104 .SH AVAILABILITY | |
| 105 Added in 7.15.4 | |
| 106 .SH RETURN VALUE | |
| 107 Returns CURLM_OK. | |
| 108 .SH "SEE ALSO" | |
| 109 .BR CURLMOPT_SOCKETDATA "(3), " curl_multi_socket_action "(3), " | |
| 110 .BR CURLMOPT_TIMERFUNCTION "(3) " |
