man curl_easy_perform(原创)

curl_easy_perform(3)           libcurl 手册                  curl_easy_perform(3)

名字
curl_easy_perform - 执行一个阻塞文件传输
摘要
#include <curl/curl.h>
CURLcode curl_easy_perform(CURL *easy_handle);curl_easy_perform
描述
调用此函数后会默认调用curl_easy_init(3)和所有的curl_easy_setopt(3),并将执行所述选项中所述的传输。它必须被easy_handle作为输入的curl_easy_init相同(3)调用返回。curl_easy_perform(3)执行一个阻塞的方式和返回时完成整个请求,或者如果它失败了。非阻塞的行为,看到curl_multi_perform(3)。

你可以做任何数量的要求curl_easy_perform(3)同时使用相同的easy_handle。如果你打算传输一个以上的文件,你甚至鼓励这样做。libcurl将试图使用相同的连接的传输,从而使作品‐tions更快,更少的CPU密集使用较少的网络资源。只是注意,你将不得不使用curl_easy_setopt(3)之间的调用为以下curl_easy_perform设置选项。

你必须调用这个函数同时使用相同的easy_handle两地。让函数返回前先调用另一个时间。如果你想要并行传输,必须使用多个卷easy_handles。

而easy_handle添加到多处理,不能用curl_easy_perform(3)。

返回值:
curle_ok(0)意味着一切都是好的,非零均值发生错误 <curl/curl.h> 定义见libcURL错误(3)。如果我‐lopt_errorbuffer(3)是集curl_easy_setopt(3)会有一个可读的错误的错误消息时,非零返回缓冲区。

范例
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}

请参考
curl_easy_init(3), curl_easy_setopt(3), curl_multi_add_handle(3), curl_multi_perform(3), libcurl-errors(3),

libcurl 7.7      5 Mar 2001      curl_easy_perform(3)

原文:

 curl_easy_perform()                                           libcurl Manual                                           curl_easy_perform()

 NAME
curl_easy_perform - perform a blocking file transfer SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_perform(CURL *easy_handle); DESCRIPTION
Invoke this function after curl_easy_init() and all the curl_easy_setopt() calls are made, and will perform the transfer as
described in the options. It must be called with the same easy_handle as input as the curl_easy_init() call returned. curl_easy_perform() performs the entire request in a blocking manner and returns when done, or if it failed. For non-blocking behav‐
ior, see curl_multi_perform(). You can do any amount of calls to curl_easy_perform() while using the same easy_handle. If you intend to transfer more than one
file, you are even encouraged to do so. libcurl will then attempt to re-use the same connection for the following transfers, thus
making the operations faster, less CPU intense and using less network resources. Just note that you will have to use
curl_easy_setopt() between the invokes to set options for the following curl_easy_perform. You must never call this function simultaneously from two places using the same easy_handle. Let the function return first before
invoking it another time. If you want parallel transfers, you must use several curl easy_handles. While the easy_handle is added to a multi handle, it cannot be used by curl_easy_perform(). RETURN VALUE
CURLE_OK () means everything was ok, non-zero means an error occurred as <curl/curl.h> defines - see libcurl-errors(). If the CUR‐
LOPT_ERRORBUFFER() was set with curl_easy_setopt() there will be a readable error message in the error buffer when non-zero is
returned. EXAMPLE
CURL *curl = curl_easy_init();
if(curl) {
CURLcode res;
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
} SEE ALSO
curl_easy_init(), curl_easy_setopt(), curl_multi_add_handle(), curl_multi_perform(), libcurl-errors(), libcurl 7.7 Mar curl_easy_perform()
上一篇:jQuery 2.1.4版本的源码分析


下一篇:WP8 对音视频格式支持的完整说明