summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_multi_info_read.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/libcurl/curl_multi_info_read.html')
-rw-r--r--docs/libcurl/curl_multi_info_read.html23
1 files changed, 21 insertions, 2 deletions
diff --git a/docs/libcurl/curl_multi_info_read.html b/docs/libcurl/curl_multi_info_read.html
index e3d2fed3..f83ed9ea 100644
--- a/docs/libcurl/curl_multi_info_read.html
+++ b/docs/libcurl/curl_multi_info_read.html
@@ -59,7 +59,7 @@ p.roffit {
<p class="level0">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 <span Class="emphasis">msgs_in_queue</span> will contain the number of remaining messages after this function was called.
<p class="level0">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.
<p class="level0"><span Class="bold">WARNING:</span> The data the returned pointer points to will not survive calling <a Class="emphasis" href="./curl_multi_cleanup.html">curl_multi_cleanup</a>, <a Class="emphasis" href="./curl_multi_remove_handle.html">curl_multi_remove_handle</a> or <a Class="emphasis" href="./curl_easy_cleanup.html">curl_easy_cleanup</a>.
-<p class="level0">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 <a Class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo</a> calls (or similar):
+<p class="level0">The 'CURLMsg' struct is very simple and only contains very basic information. If more involved information is wanted, the particular "easy handle" is present in that struct and can be used in subsequent regular <a Class="emphasis" href="./curl_easy_getinfo.html">curl_easy_getinfo</a> calls (or similar):
<p class="level0"><pre class="level0">
&nbsp;struct CURLMsg {
&nbsp; CURLMSG msg; /* what this message means */
@@ -72,7 +72,26 @@ p.roffit {
</pre>
<p class="level0">When <span Class="bold">msg</span> is <span Class="emphasis">CURLMSG_DONE</span>, the message identifies a transfer that is done, and then <span Class="bold">result</span> contains the return code for the easy handle that just completed.
-<p class="level0">At this point, there are no other <span Class="bold">msg</span> types defined. <a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
+<p class="level0">At this point, there are no other <span Class="bold">msg</span> types defined. <a name="EXAMPLE"></a><h2 class="nroffsh">EXAMPLE</h2>
+<p class="level0"><pre class="level0">
+struct CURLMsg *m;
+&nbsp;
+/* call curl_multi_perform or curl_multi_socket_action first, then loop
+&nbsp; through and check if there are any transfers that have completed */
+&nbsp;
+do {
+&nbsp; int msgq = 0;
+&nbsp; m = curl_multi_info_read(multi_handle, &msgq);
+&nbsp; if(m && (m-&gt;msg == CURLMSG_DONE)) {
+&nbsp; CURL *e = m-&gt;easy_handle;
+&nbsp; transfers--;
+&nbsp; curl_multi_remove_handle(multi_handle, e);
+&nbsp; curl_easy_cleanup(e);
+&nbsp; }
+} while(m);
+</pre>
+
+<p class="level0"><a name="RETURN"></a><h2 class="nroffsh">RETURN VALUE</h2>
<p class="level0">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. <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
<p class="level0"><a Class="manpage" href="./curl_multi_cleanup.html">curl_multi_cleanup</a>, <a Class="manpage" href="./curl_multi_init.html">curl_multi_init</a>, <a Class="manpage" href="./curl_multi_perform.html">curl_multi_perform</a>, <p class="roffit">
This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.