[译]curl_multi_info_read

curl_multi_info_read - read multi stack informationals
读取multi stack中的信息

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.
向multi handle查询单个传输的是否有messages/informationals。
messages包括error code或传输已完成。

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.
重复调用这个函数,每次会返回一个新的struct,
直到返回NULL时表明当前已经没有信息可以获取了。
第二个参数msgs_in_queue表明经过这次函数调用,还剩下多少消息。

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, curl_multi_remove_handle or curl_easy_cleanup.
在调用curl_multi_cleanup、curl_multi_remove_handle、curl_easy_cleanup之后,
调用curl_multi_info_read返回的指向数据的指针将不再存在。

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 calls (or similar):
CURLMsg只包含了最简单的信息,如果需要更多的信息,
可以使用curl_easy_getinfo函数对CURLMsg结构内的easy_handle取得更多的信息。

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.
当CURLMsg中的CURLMSG msg为CURLMSG_DONE,表明传输已经完成,
并且包含完成的easy handle的return code.


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.
一个指向结构体的指针,或者当创建结构体失败时指针为NULL。
并且第二个参数msgs_in_queue表示内部消息队列中剩余的消息数。

 

posted on 2015-03-03 16:15  solohac  阅读(2033)  评论(0编辑  收藏  举报

导航