cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl help about the time out

From: jelllove <jelllove_at_126.com>
Date: Fri, 11 Feb 2011 13:27:32 +0800

Hi,
I have a puzzle about the time out.
I have this simple code blow:
/******************************************/
#include <stdio.h>
#include <curl/curl.h>
 
int main(void)
{
  CURL *curl;
  CURLcode res;
 
  curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com");
    
for (int i = 0; i < 1000; i++)
{
/* part 1 */
res = curl_easy_perform(curl);
/* part 2 */
}
    curl_easy_cleanup(curl);
  }
  return 0;
}
/******************************************/
I want to visit the website for 1000 times.
But I hope that each visit can be done within 5 second.
That's mean if there is no reply from server from "Part 1" to "Part 2", then just timeout.
I don't know how can I do this.
Could you give me a help!
Thanks advance.
jell

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-11