cURL / Mailing Lists / curl-library / Single Mail

curl-library

Reason for closing TCP connection in case no data is received

From: lali .cpp <lali.cpp_at_gmail.com>
Date: Tue, 5 Mar 2013 17:24:41 +0530

Hi,

I am using libcurl 7.29.0 and I am using the multi-interface. I am using a
Linux(RHEL 5) system and using select() for timeout.

Here is the pseudo code :-

1. curl_global_init(CURL_GLOBAL_ALL);
2. curl_multi_init()
3. initialize an easy handle i.e curl_easy_init
4. set options in the easy handle
5. add the easy handle into multi handle
6. do multi perform (with select) and setting select timeout as 10 seconds
7. after perform, remove the easy handle from multi handle

I am never cleaning the easy or multi handle and I intend to use persistent
connections. What I have observed is that in case libcurl doesn't get
response within 10 seconds i.e my timeout, it closes the connection already
established. I am using libcurl for HTTP protocol.

I want to know the reason for this behavior since I don't want to teardown
the TCP connection even in case of timeout. This is a performance overhead
and I want to remove this behaviour

Here are the debug logs :-

* About to connect() to 172.16.4.12 port 8080 (#0)
* Trying 172.16.4.12...
* *Connected* to 172.16.4.12 (172.16.4.12) port 8080 (#0)
> GET /test.php HTTP/1.1
Host: 172.16.4.12:8080
Accept: */*

* *Closing connection *0

Regards
kartik

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