cURL
Haxx ad
libcurl

Shopping cart software, Online file storage, Online photo storage, Hosted shopping cart, Contact management software, Email marketing software, Project management software, Issue tracking software, Online notepad, Web publishing software

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Archives

HTTPS persistent connections state check

From: Massimo Schiappa <massimo.schiappa_at_gmail.com>
Date: Fri, 27 Nov 2009 21:49:02 +0100

Hi all,
i'm using the easy interface of libcurl for a client https, whose connections towards a web server should be persistent (using Http 1.1 this should be ensured by the http keepalive mechanism).
To check the state of such connections i'm thinking to use the following code snippet:

...
long socketDescriptor = -1;
CURLcode code = curl_easy_setopt(myCurl, CURLINFO_LASTSOCKET, &socketDescriptor);
...
if ( socketDescriptor == -1 )
{
    // Connection is no more up
}
else
{
    // Connection is still up
}
...

Is it the right way, or is there another and better way?
And in a multithreaded environment could this check conflict with an https operation performed on this connection?
Massimo

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

These mail archives are generated by hypermail.

donate! Page updated November 16, 2009.
web site info

File upload with ASP.NET