Http://curl.haxx.se/libcurl/c/curl_multi_perform.html
CURL_MULTI_PERFORM.3--Man page
NAME
Curl_multi_perform-reads/writes available data from each easy handle
Read and write data on each easy handle
Synopsis
#include <curl/curl.h>
Curlmcode Curl_multi_perform (CURLM *multi_handle, int *running_handles);
DESCRIPTION
This function handles transfers on all the added handles that need attention in an non-blocking fashion.
This function handles all the non-blocking handle that need attention in addition to multi handle
When an application have found out there's data available for the Multi_handle or a timeout have elapsed, the application Should call this function to read/write whatever there are to read or write right now etc. Curl_multi_perform returns as S Oon as the reads/writes is done. This function does isn't require that there actually was any data available for reading or so data can be written, it can B E called just in case. It would write the number of handles that still transfer data in the second argument ' s integer-pointer.
When a program discovers Mulit handle available data or has a timeout, the
program should call the Curl_multi_perform function to read and write the data.
when read and write is complete, Curl_multi_perform returns immediately.
This function does not need to have actual read-write data at this time, so you can call him in case.
This function writes the handle of the second parameter that still transmits the data.
If The amount of running_handles is changed from the previous call (or are less than the amount of easy handles you ' ve Adde D to the multi handle), you know that there are one or more transfers less "running". You can then call Curl_multi_info_read to get information on each individual completed transfer, and that returned info Includes Curlcode and more. If an added handle fails very quickly, it could never be counted as a running_handle.
If the Running_handles parameter was modified (increased or decreased) before the function call
You know there's still one or more handle still transmitting data, and you can call Curl_multi_info_read to get the information for each handle,
The information available includes curlcode and some other information.
If you fail quickly when adding handle, the handle counter does not increase.
When running_handles are set to zero (0) on the return of this function, there is no longer any transfers in progress.
If the returned running_handles is 0, it indicates that no handle is currently transmitting the data.
RETURN VALUE
return value
Curlmcode type, general Libcurl multi interface error code.
Curlmcode type, usually multi interface error code
Before version 7.20.0:if you receive curlm_call_multi_perform, this basically means so you should call Curl_multi_pe Rform again, before you select () on the more actions. You don ' t has to does it immediately, but the return code means this libcurl may has more data available to return or that There may was more data to send off before it was "satisfied". Do note that Curl_multi_perform would return curlm_call_multi_perform only if it wants to be called again immediately. When things was fine and there is nothing immediate it wants do, it ' ll return CURLM_OK and you need to wait for "action" And then call the This function again.
versions prior to 7.20.0:
If you receive curlm_call_multi_perform, this basically means that you need to call Curl_multi_perform again before you select or do other operations.
This function is only returns errors etc regarding the whole multi stack. Problems still might has occurred on individual transfers even if this function returns CURLM_OK. Use Curl_multi_info_read to figure out how individual transfers did.
This function simply returns the error code for the entire multi stack.
The problem may still exist in a transport, even if the function returns CURLM_OK.
Use Curl_multi_info_read to find the transmission of the problem.
Typical USAGE
Main purpose
Most applications would use Curl_multi_fdset to get the Multi_handle's file descriptors, and curl_multi_timeout to get a su Itable timeout period, then it's ' ll wait for action on the file descriptors using Select (3). As soon as one or more file descriptor are ready, Curl_multi_perform gets called.
Most programs use Curl_multi_fdset to get multi handle file descriptors,
Use Curl_multi_timeout to get an appropriate timeout period,
Then use Select to wait for changes on the file descriptor.
Once one or more file descriptor states are ready, call Curl_multi_perform.
[Translate]curl_multi_perform