Imported Upstream version 7.40.0
[platform/upstream/curl.git] / docs / libcurl / curl_multi_perform.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, 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 http://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_perform 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
23 .SH NAME
24 curl_multi_perform - reads/writes available data from each easy handle
25 .SH SYNOPSIS
26 #include <curl/curl.h>
27
28 CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles);
29 .ad
30 .SH DESCRIPTION
31 This function handles transfers on all the added handles that need attention
32 in an non-blocking fashion.
33
34 When an application has found out there's data available for the multi_handle
35 or a timeout has elapsed, the application should call this function to
36 read/write whatever there is to read or write right now etc.
37 \fIcurl_multi_perform(3)\fP returns as soon as the reads/writes are done. This
38 function does not require that there actually is any data available for
39 reading or that data can be written, it can be called just in case. It will
40 write the number of handles that still transfer data in the second argument's
41 integer-pointer.
42
43 If the amount of \fIrunning_handles\fP is changed from the previous call (or
44 is less than the amount of easy handles you've added to the multi handle), you
45 know that there is one or more transfers less "running". You can then call
46 \fIcurl_multi_info_read(3)\fP to get information about each individual
47 completed transfer, and that returned info includes CURLcode and more. If an
48 added handle fails very quickly, it may never be counted as a running_handle.
49
50 When \fIrunning_handles\fP is set to zero (0) on the return of this function,
51 there is no longer any transfers in progress.
52 .SH "RETURN VALUE"
53 CURLMcode type, general libcurl multi interface error code.
54
55 Before version 7.20.0: If you receive \fICURLM_CALL_MULTI_PERFORM\fP, this
56 basically means that you should call \fIcurl_multi_perform(3)\fP again, before
57 you select() on more actions. You don't have to do it immediately, but the
58 return code means that libcurl may have more data available to return or that
59 there may be more data to send off before it is "satisfied". Do note that
60 \fIcurl_multi_perform(3)\fP will return \fICURLM_CALL_MULTI_PERFORM\fP only
61 when it wants to be called again \fBimmediately\fP. When things are fine and
62 there is nothing immediate it wants done, it'll return \fICURLM_OK\fP and you
63 need to wait for \&"action" and then call this function again.
64
65 This function only returns errors etc regarding the whole multi stack.
66 Problems still might have occurred on individual transfers even when this
67 function returns \fICURLM_OK\fP. Use \fIcurl_multi_info_read(3)\fP to figure
68 out how individual transfers did.
69 .SH "TYPICAL USAGE"
70 Most applications will use \fIcurl_multi_fdset(3)\fP to get the multi_handle's
71 file descriptors, and \fIcurl_multi_timeout(3)\fP to get a suitable timeout
72 period, then it'll wait for action on the file descriptors using
73 \fBselect(3)\fP. As soon as one or more file descriptor is ready,
74 \fIcurl_multi_perform(3)\fP gets called.
75 .SH "SEE ALSO"
76 .BR curl_multi_cleanup "(3), " curl_multi_init "(3), "
77 .BR curl_multi_wait "(3), "
78 .BR curl_multi_fdset "(3), " curl_multi_info_read "(3), "
79 .BR libcurl-errors "(3)"