Git init
[external/curl.git] / docs / libcurl / curl_multi_perform.3
1 .\"
2 .TH curl_multi_perform 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
3 .SH NAME
4 curl_multi_perform - reads/writes available data from each easy handle
5 .SH SYNOPSIS
6 #include <curl/curl.h>
7
8 CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles);
9 .ad
10 .SH DESCRIPTION
11 When the app thinks there's data available for the multi_handle, it should
12 call this function to read/write whatever there is to read or write right
13 now. curl_multi_perform() returns as soon as the reads/writes are done. This
14 function does not require that there actually is any data available for
15 reading or that data can be written, it can be called just in case. It will
16 write the number of handles that still transfer data in the second argument's
17 integer-pointer.
18
19 When you call curl_multi_perform() and the amount of \fIrunning_handles\fP is
20 changed from the previous call (or is less than the amount of easy handles
21 you've added to the multi handle), you know that there is one or more
22 transfers less "running". You can then call \fIcurl_multi_info_read(3)\fP to
23 get information about each individual completed transfer, and that returned
24 info includes CURLcode and more. If an added handle fails very quickly, it may
25 never be counted as a running_handle.
26
27 When \fIrunning_handles\fP is set to zero (0) on the return of this function,
28 there is no longer any transfers in progress.
29 .SH "RETURN VALUE"
30 CURLMcode type, general libcurl multi interface error code.
31
32 Before version 7.20.0: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this
33 basically means that you should call \fIcurl_multi_perform\fP again, before
34 you select() on more actions. You don't have to do it immediately, but the
35 return code means that libcurl may have more data available to return or that
36 there may be more data to send off before it is "satisfied". Do note that
37 \fIcurl_multi_perform(3)\fP will return \fICURLM_CALL_MULTI_PERFORM\fP only
38 when it wants to be called again \fBimmediately\fP. When things are fine and
39 there is nothing immediate it wants done, it'll return \fICURLM_OK\fP and you
40 need to wait for \&"action" and then call this function again.
41
42 This function only returns errors etc regarding the whole multi stack.
43 Problems still might have occurred on individual transfers even when this
44 function returns \fICURLM_OK\fP.
45 .SH "TYPICAL USAGE"
46 Most applications will use \fIcurl_multi_fdset(3)\fP to get the multi_handle's
47 file descriptors, then it'll wait for action on them using \fBselect(3)\fP and
48 as soon as one or more of them are ready, \fIcurl_multi_perform(3)\fP gets
49 called.
50 .SH "SEE ALSO"
51 .BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
52 .BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
53 .BR libcurl-errors "(3)"