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