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

Re: HTTPS persistent connections state check

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 29 Nov 2009 19:34:24 +0100 (CET)

On Fri, 27 Nov 2009, Massimo Schiappa wrote:

> 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).

> CURLcode code = curl_easy_setopt(myCurl, CURLINFO_LASTSOCKET, &socketDescriptor);

> if ( socketDescriptor == -1 )
> {
> // Connection is no more up
> }

> Is it the right way, or is there another and better way?

libcurl is designed to provide the same functionality no matter if the
connection is kept alive or not and when using libcurl's API you really
shouldn't need to care about the connection being alive or not.

The above method is probably working, although of course it only tells about
the socket in that exact moment.

> And in a multithreaded environment could this check conflict with an https
> operation performed on this connection?

No other thread can perform on the same connection at the same time, as
libcurl doesn't really allow you do operate that way.

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

These mail archives are generated by hypermail.

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

File upload with ASP.NET