1curl_multi_perform(3) libcurl Manual curl_multi_perform(3)
2
3
4
6 curl_multi_perform - reads/writes available data from each easy handle
7
9 #include <curl/curl.h>
10
11 CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_han‐
12 dles);
13
15 This function handles transfers on all the added handles that need
16 attention in an non-blocking fashion.
17
18 When an application has found out there's data available for the
19 multi_handle or a timeout has elapsed, the application should call this
20 function to read/write whatever there is to read or write right now
21 etc. curl_multi_perform() returns as soon as the reads/writes are
22 done. This function does not require that there actually is any data
23 available for reading or that data can be written, it can be called
24 just in case. It will write the number of handles that still transfer
25 data in the second argument's integer-pointer.
26
27 If the amount of running_handles is changed from the previous call (or
28 is less than the amount of easy handles you've added to the multi han‐
29 dle), you know that there is one or more transfers less "running". You
30 can then call curl_multi_info_read(3) to get information about each
31 individual completed transfer, and that returned info includes CURLcode
32 and more. If an added handle fails very quickly, it may never be
33 counted as a running_handle.
34
35 When running_handles is set to zero (0) on the return of this function,
36 there is no longer any transfers in progress.
37
39 CURLMcode type, general libcurl multi interface error code.
40
41 Before version 7.20.0: If you receive CURLM_CALL_MULTI_PERFORM, this
42 basically means that you should call curl_multi_perform again, before
43 you select() on more actions. You don't have to do it immediately, but
44 the return code means that libcurl may have more data available to
45 return or that there may be more data to send off before it is "satis‐
46 fied". Do note that curl_multi_perform(3) will return
47 CURLM_CALL_MULTI_PERFORM only when it wants to be called again immedi‐
48 ately. When things are fine and there is nothing immediate it wants
49 done, it'll return CURLM_OK and you need to wait for "action" and then
50 call this function again.
51
52 This function only returns errors etc regarding the whole multi stack.
53 Problems still might have occurred on individual transfers even when
54 this function returns CURLM_OK. Use curl_multi_info_read(3) to figure
55 out how individual transfers did.
56
58 Most applications will use curl_multi_fdset(3) to get the multi_han‐
59 dle's file descriptors, and curl_multi_timeout(3) to get a suitable
60 timeout period, then it'll wait for action on the file descriptors
61 using select(3). As soon as one or more file descriptor is ready,
62 curl_multi_perform(3) gets called.
63
65 curl_multi_cleanup(3), curl_multi_init(3), curl_multi_fdset(3),
66 curl_multi_info_read(3), libcurl-errors(3)
67
68
69
70libcurl 7.9.5 1 March 2002 curl_multi_perform(3)