comparison mupdf-source/thirdparty/curl/docs/libcurl/curl_multi_socket_action.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 .TH curl_multi_socket_action 3 "9 Jul 2006" "libcurl 7.16.0" "libcurl Manual"
23 .SH NAME
24 curl_multi_socket_action \- reads/writes available data given an action
25 .SH SYNOPSIS
26 .nf
27 #include <curl/curl.h>
28
29 CURLMcode curl_multi_socket_action(CURLM * multi_handle,
30 curl_socket_t sockfd,
31 int ev_bitmask,
32 int *running_handles);
33 .fi
34 .SH DESCRIPTION
35 When the application has detected action on a socket handled by libcurl, it
36 should call \fIcurl_multi_socket_action(3)\fP with the \fBsockfd\fP argument
37 set to the socket with the action. When the events on a socket are known, they
38 can be passed as an events bitmask \fBev_bitmask\fP by first setting
39 \fBev_bitmask\fP to 0, and then adding using bitwise OR (|) any combination of
40 events to be chosen from CURL_CSELECT_IN, CURL_CSELECT_OUT or
41 CURL_CSELECT_ERR. When the events on a socket are unknown, pass 0 instead, and
42 libcurl will test the descriptor internally. It is also permissible to pass
43 CURL_SOCKET_TIMEOUT to the \fBsockfd\fP parameter in order to initiate the
44 whole process or when a timeout occurs.
45
46 At return, \fBrunning_handles\fP points to the number of running easy handles
47 within the multi handle. When this number reaches zero, all transfers are
48 complete/done. When you call \fIcurl_multi_socket_action(3)\fP on a specific
49 socket and the counter decreases by one, it DOES NOT necessarily mean that
50 this exact socket/transfer is the one that completed. Use
51 \fIcurl_multi_info_read(3)\fP to figure out which easy handle that completed.
52
53 The \fIcurl_multi_socket_action(3)\fP function informs the application about
54 updates in the socket (file descriptor) status by doing none, one, or multiple
55 calls to the socket callback function set with the
56 \fICURLMOPT_SOCKETFUNCTION(3)\fP option to \fIcurl_multi_setopt(3)\fP. They
57 update the status with changes since the previous time the callback was
58 called.
59
60 Get the timeout time by setting the \fICURLMOPT_TIMERFUNCTION(3)\fP option
61 with \fIcurl_multi_setopt(3)\fP. Your application will then get called with
62 information on how long to wait for socket actions at most before doing the
63 timeout action: call the \fIcurl_multi_socket_action(3)\fP function with the
64 \fBsockfd\fP argument set to CURL_SOCKET_TIMEOUT. You can also use the
65 \fIcurl_multi_timeout(3)\fP function to poll the value at any given time, but
66 for an event-based system using the callback is far better than relying on
67 polling the timeout value.
68 .SH "TYPICAL USAGE"
69 1. Create a multi handle
70
71 2. Set the socket callback with \fICURLMOPT_SOCKETFUNCTION(3)\fP
72
73 3. Set the timeout callback with \fICURLMOPT_TIMERFUNCTION(3)\fP, to get to
74 know what timeout value to use when waiting for socket activities.
75
76 4. Add easy handles with curl_multi_add_handle()
77
78 5. Provide some means to manage the sockets libcurl is using, so you can check
79 them for activity. This can be done through your application code, or by way
80 of an external library such as libevent or glib.
81
82 6. Call curl_multi_socket_action(..., CURL_SOCKET_TIMEOUT, 0, ...)
83 to kickstart everything. To get one or more callbacks called.
84
85 7. Wait for activity on any of libcurl's sockets, use the timeout value your
86 callback has been told.
87
88 8, When activity is detected, call curl_multi_socket_action() for the
89 socket(s) that got action. If no activity is detected and the timeout expires,
90 call \fIcurl_multi_socket_action(3)\fP with \fICURL_SOCKET_TIMEOUT\fP.
91 .SH AVAILABILITY
92 This function was added in libcurl 7.15.4, and is deemed stable since 7.16.0.
93 .SH "SEE ALSO"
94 .BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
95 .BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
96 .BR "the hiperfifo.c example"