- 論壇徽章:
- 0
|
看例子有介紹說,- CURL *curl;
- CURLcode res;
-
- curl_global_init(CURL_GLOBAL_ALL);
-
- curl = curl_easy_init();
- if(curl) {
- /* get the first document */
- curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/");
- res = curl_easy_perform(curl);
-
- /* get another document from the same server using the same
- connection */
- curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/docs/");
- res = curl_easy_perform(curl);
-
- /* always cleanup */
- curl_easy_cleanup(curl);
- }
復(fù)制代碼 意思是說:在init成功后,cleanup之前,curl handle會(huì)保持一個(gè)長(zhǎng)連接,比如在完成http://example.com/的請(qǐng)求后,再請(qǐng)求http://example.com/docs/,沒有斷開連接。
我想問的是,curl handle能保持多個(gè)服務(wù)器的長(zhǎng)連接么?
比如,請(qǐng)求了163.com/aaa 后,再請(qǐng)求sohu.com/aaa,接著又請(qǐng)求163.com/bbb,那么這里到163.com是否會(huì)保持長(zhǎng)連接? |
|