1curl_multi_socket(3) libcurl Manual curl_multi_socket(3)
2
3
4
6 curl_multi_socket - reads/writes available data
7
9 #include <curl/curl.h>
10 CURLMcode curl_multi_socket(CURLM *multi_handle, curl_socket_t sockfd,
11 int *running_handles);
12
13 CURLMcode curl_multi_socket_all(CURLM *multi_handle,
14 int *running_handles);
15
17 These functions are deprecated. Do not use. See curl_multi_socket_ac‐
18 tion(3) instead.
19
20 At return, the integer running_handles points to will contain the num‐
21 ber of still running easy handles within the multi handle. When this
22 number reaches zero, all transfers are complete/done. Note that when
23 you call curl_multi_socket_action(3) on a specific socket and the
24 counter decreases by one, it DOES NOT necessarily mean that this exact
25 socket/transfer is the one that completed. Use curl_multi_info_read(3)
26 to figure out which easy handle that completed.
27
28 The curl_multi_socket_action(3) functions inform the application about
29 updates in the socket (file descriptor) status by doing none, one, or
30 multiple calls to the socket callback function set with the CURL‐
31 MOPT_SOCKETFUNCTION(3) option to curl_multi_setopt(3). They update the
32 status with changes since the previous time the callback was called.
33
34 Get the timeout time by setting the CURLMOPT_TIMERFUNCTION(3) option
35 with curl_multi_setopt(3). Your application will then get called with
36 information on how long to wait for socket actions at most before doing
37 the timeout action: call the curl_multi_socket_action(3) function with
38 the sockfd argument set to CURL_SOCKET_TIMEOUT. You can also use the
39 curl_multi_timeout(3) function to poll the value at any given time, but
40 for an event-based system using the callback is far better than relying
41 on polling the timeout value.
42
43 Usage of curl_multi_socket(3) is deprecated, whereas the function is
44 equivalent to curl_multi_socket_action(3) with ev_bitmask set to 0.
45
46 Force libcurl to (re-)check all its internal sockets and transfers in‐
47 stead of just a single one by calling curl_multi_socket_all(3). Note
48 that there should not be any reason to use this function.
49
51 /* the event-library gets told when there activity on the socket 'fd',
52 which we translate to a call to curl_multi_socket_action() */
53 int running;
54 rc = curl_multi_socket(multi_handle, fd, &running);
55
57 This function was added in libcurl 7.15.4, and is deemed stable since
58 7.16.0.
59
60 curl_multi_socket(3) is deprecated, use curl_multi_socket_action(3) in‐
61 stead!
62
64 CURLMcode type, general libcurl multi interface error code.
65
66 The return code is for the whole multi stack. Problems still might have
67 occurred on individual transfers even when one of these functions re‐
68 turn OK.
69
71 curl_multi_cleanup(3), curl_multi_init(3), curl_multi_fdset(3),
72 curl_multi_info_read(3), the hiperfifo.c example
73
74
75
76libcurl 7.82.0 January 11, 2022 curl_multi_socket(3)