diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-06-02 12:00:37 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-06-02 12:01:39 +0200 |
commit | 3cac8c90498bf156233c79034e0866ea2ee45b52 (patch) | |
tree | 012314445af856876df7525aec505cec9d58a6ea /docs | |
parent | 33ee4118483111876c00e68004bc50674992eda2 (diff) |
curl_multi_info_read.3: added example
Diffstat (limited to 'docs')
-rw-r--r-- | docs/libcurl/curl_multi_info_read.3 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/libcurl/curl_multi_info_read.3 b/docs/libcurl/curl_multi_info_read.3 index a23ea7138..bdf89863f 100644 --- a/docs/libcurl/curl_multi_info_read.3 +++ b/docs/libcurl/curl_multi_info_read.3 @@ -68,6 +68,23 @@ is done, and then \fBresult\fP contains the return code for the easy handle that just completed. At this point, there are no other \fBmsg\fP types defined. +.SH EXAMPLE +struct CURLMsg *m; + +/* call curl_multi_perform or curl_multi_socket_action first, then loop + through and check if there are any transfers that have completed */ + +do { + int msgq = 0; + m = curl_multi_info_read(multi_handle, &msgq); + if(m && (m->msg == CURLMSG_DONE)) { + CURL *e = m->easy_handle; + transfers--; + curl_multi_remove_handle(multi_handle, e); + curl_easy_cleanup(e); + } +} while(m); + .SH "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 |