cURL / Mailing Lists / curl-library / Single Mail

curl-library

Aw: Re: the connection ID Number increase always..

From: dfgfgdf sdfsdf <diydiy_at_gmx.de>
Date: Mon, 15 Apr 2013 09:32:40 +0200 (CEST)
Hi,
 
thanks for your so rapid reply!
Yes, that should be my question:
 
How can i reuse my connection in my loop?
 
My code is:
 
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Content-type:text/xml");
headers = curl_slist_append(headers, "Expect:");
sprintf(postURL,"http://%s/servlet/servlet",ACIP);
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, postURL);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, content);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(content));
curl_easy_setopt(curl, CURLOPT_POST, 1);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);//show Debug Infos
curl_easy_setopt(curl, CURLOPT_HEADER, 0);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, rBuf);
 
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 2);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 2);
curl_easy_setopt(curl, CURLOPT_NOSIGNAL,1);
curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
curl_easy_setopt(curl, CURLOPT_BUFFERSIZE, 5000);
 
res = curl_easy_perform(curl);
if(res != CURLE_OK) {
  printf( "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
  }
curl_easy_cleanup(curl);
 
}
curl_slist_free_all(headers);
 
I tried the function curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1); with 0, but the result is not changed. Should i make the curl_easy_init(); before my LOOP?
 
Gesendet: Montag, 15. April 2013 um 08:34 Uhr
Von: "Daniel Stenberg" <daniel@haxx.se>
An: "libcurl development" <curl-library@cool.haxx.se>
Betreff: Re: the connection ID Number increase always..
On Mon, 15 Apr 2013, dfgfgdf sdfsdf wrote:

> In my infinite Loop the connection ID which start with"#" increase always,
> even the connection is closed later! And it may exceed the max-Integer of my
> Linux in future?

1. It only increases when a new connection is created, not for re-used ones.

2. If you create 100 new connections per second, it'll still take you 248 days
to wrap the counter. Few programs run uninterrupted at that speed that long.

3. A wrapped counter shouldn't be a problem, the connection_id is for
displaying purposes to allow humans to associate log entries with connections.

--

/ daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-15