cURL / Mailing Lists / curl-library / Single Mail

curl-library

How to identify graceful disconnection by remote peer while using multi-interface

From: ajil koshy <ajil.koshy_at_gmail.com>
Date: Wed, 8 Feb 2012 19:54:54 +0530

Hi,

I have written an HTTPS client application using libcurl v7.23.1 (powered
by openssl for SSL support) on windows. I am using multi-interface to
connect to a remote HTTPS server and exchange data. Only a single easy
handle is added to the multi-stack. As illustrated in the code example for
using multi-interface on the libcurl site, I alternately call multi-perform
& select API in a loop. Once my client and the remote server have exchanged
data, the remote server sends ssl_close_notify and closes the TCP
connection.

I would like to know on the client side, what is the right way to identify
that the remote peer has disconnected gracefully i.e. closed the TCP
connection?

I have emperically verified that max_fd contains a value of -1 if we call
curl_multi_fdset () after remote peer has disconnected but I doubt if this
can be used as an indicator for deducing this (based on documentation of
culr_multi_fdset ()). I would expect that the number of running easy
handles to hit zero if peer disconnects but this doesn't happen.

Thanks
Ajil Koshy

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