cURL / Mailing Lists / curl-library / Single Mail

curl-library

Connection and Response Timeout for Curl Handle

From: Praveen Pvs <meetpraveenpvs_at_gmail.com>
Date: Tue, 3 Mar 2015 13:42:16 -0600

Hi,

Please help me to understand these settings for curl handle.

I have set my connection time out to be 10 and response time out to be 10
secs in my configuration. Following is the code snippet for settings these
values to the curl handle.

/* Set the connection timeout */
curl_easy_setopt(locHandle, CURLOPT_CONNECTTIMEOUT, hostDef.conTimeOut);

/* Set the total timeout */
if(hostDef.respTimeOut > 0)
{
curl_easy_setopt(locHandle, CURLOPT_TIMEOUT,
hostDef.respTimeOut);
}

I need to post the data to the server in my application, I am checking the
behaviour/fallback situation when connection is not available to the host.

I have putoff switch to the outside network to create the host down
situation

In the logs i have observed that application takes close to 50 secs to
determine that it is not able to connect to the host. I thought
CURLOPT_CONNECTTIMEOUT would determine what is the maximum time it should
wait for the connection check. Is my understanding wrong here??

Please observe the logs of my application below, curl_easy_perform function
is called at 09:01:58:433 and it returned value 6 at 09:02:54:479. it took
close to 56 secs. I expect it to take 10 secs since conntimeout is set to
10. Am i missing something here?

03/03/2015 09:01:58:430 0768 793216112 PS: initSSICURLHandle: Url: https://x
<https://apidemo.ipcharge.net/IPCHAPI/rh.aspx>xxxxxxxxxxxxxxxxx

03/03/2015 09:01:58:430 0768 793216112 PS: initSSICURLHandle: Url starts
with https. Cert Validation required

03/03/2015 09:01:58:431 0768 793216112 PS: initSSICURLHandle: Setting PWC
URL = [https://apidemo.ipcharge.net/IPCHAPI/rh.aspx]

03/03/2015 09:01:58:431 0768 793216112 PS: commonInit: --- enter ---

03/03/2015 09:01:58:431 0768 793216112 PS: commonInit: Url starts with
https. Doing certificate validation

03/03/2015 09:01:58:432 0768 793216112 PS: commonInit: --- returning ---

03/03/2015 09:01:58:432 0768 793216112 PS: initSSICURLHandle: Returning [0]

03/03/2015 09:01:58:432 0768 793216112 PS: sendDataToHost: --- enter ---

03/03/2015 09:01:58:433 0768 793216112 PS: initializeRespData: --- enter ---

03/03/2015 09:01:58:433 0768 793216112 PS: initializeRespData: Returning [0]

03/03/2015 09:01:58:433 0768 793216112 PS: sendDataToHost: Posting the data
to the server

03/03/2015 09:02:54:479 0768 793216112 PS: sendDataToHost:
curl_easy_perform done, rv = 6

03/03/2015 09:02:54:479 0768 793216112 PS: sendDataToHost: Couldnt resolve
server's address

03/03/2015 09:02:54:480 0768 793216112 PS: sendDataToHost: Returning [-114]

03/03/2015 09:02:54:480 0768 793216112 PS: postDataToSSIHost: Failed to
post data to server

Regards
Praveen

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