curl_multi_info_read(3) [osx man page]
curl_multi_info_read(3) libcurl Manual curl_multi_info_read(3) NAME
curl_multi_info_read - read multi stack informationals SYNOPSIS
#include <curl/curl.h> CURLMsg *curl_multi_info_read( CURLM *multi_handle, int *msgs_in_queue); DESCRIPTION
Ask the multi handle if there are any messages/informationals from the individual transfers. Messages may include informationals such as an error code from the transfer or just the fact that a transfer is completed. More details on these should be written down as well. Repeated calls to this function will return a new struct each time, until a NULL is returned as a signal that there is no more to get at this point. The integer pointed to with msgs_in_queue will contain the number of remaining messages after this function was called. When you fetch a message using this function, it is removed from the internal queue so calling this function again will not return the same message again. It will instead return new messages at each new invoke until the queue is emptied. WARNING: The data the returned pointer points to will not survive calling curl_multi_cleanup(3), curl_multi_remove_handle(3) or curl_easy_cleanup(3). The 'CURLMsg' struct is very simple and only contains very basic information. If more involved information is wanted, the particular "easy handle" in present in that struct and can thus be used in subsequent regular curl_easy_getinfo(3) calls (or similar): struct CURLMsg { CURLMSG msg; /* what this message means */ CURL *easy_handle; /* the handle it concerns */ union { void *whatever; /* message-specific data */ CURLcode result; /* return code for transfer */ } data; }; When msg is CURLMSG_DONE, the message identifies a transfer that is done, and then result contains the return code for the easy handle that just completed. At this point, there are no other msg types defined. RETURN VALUE
A pointer to a filled-in struct, or NULL if it failed or ran out of structs. It also writes the number of messages left in the queue (after this read) in the integer the second argument points to. SEE ALSO
curl_multi_cleanup(3), curl_multi_init(3), curl_multi_perform(3) libcurl 7.10.3 18 Dec 2004 curl_multi_info_read(3)
Check Out this Related Man Page
curl_multi_perform(3) libcurl Manual curl_multi_perform(3) NAME
curl_multi_perform - reads/writes available data from each easy handle SYNOPSIS
#include <curl/curl.h> CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles); DESCRIPTION
When the app thinks there's data available for the multi_handle, it should call this function to read/write whatever there is to read or write right now. curl_multi_perform() returns as soon as the reads/writes are done. This function does not require that there actually is any data available for reading or that data can be written, it can be called just in case. It will write the number of handles that still transfer data in the second argument's integer-pointer. When you call curl_multi_perform() and the amount of running_handles is changed from the previous call (or is less than the amount of easy handles you've added to the multi handle), you know that there is one or more transfers less "running". You can then call curl_multi_info_read(3) to get information about each individual completed transfer, and that returned info includes CURLcode and more. If an added handle fails very quickly, it may never be counted as a running_handle. When running_handles is set to zero (0) on the return of this function, there is no longer any transfers in progress. RETURN VALUE
CURLMcode type, general libcurl multi interface error code. Before version 7.20.0: If you receive CURLM_CALL_MULTI_PERFORM, this basically means that you should call curl_multi_perform again, before you select() on more actions. You don't have to do it immediately, but the return code means that libcurl may have more data available to return or that there may be more data to send off before it is "satisfied". Do note that curl_multi_perform(3) will return CURLM_CALL_MULTI_PERFORM only when it wants to be called again immediately. When things are fine and there is nothing immediate it wants done, it'll return CURLM_OK and you need to wait for "action" and then call this function again. This function only returns errors etc regarding the whole multi stack. Problems still might have occurred on individual transfers even when this function returns CURLM_OK. TYPICAL USAGE
Most applications will use curl_multi_fdset(3) to get the multi_handle's file descriptors, then it'll wait for action on them using select(3) and as soon as one or more of them are ready, curl_multi_perform(3) gets called. SEE ALSO
curl_multi_cleanup(3), curl_multi_init(3), curl_multi_fdset(3), curl_multi_info_read(3), libcurl-errors(3) libcurl 7.9.5 1 March 2002 curl_multi_perform(3)