cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_recv and disconnections

From: Craig Davison <cdavison_at_sourcefire.com>
Date: Sun, 13 Jan 2013 19:49:26 -0700

Hello,
When using curl_easy_recv(), what is the correct way to determine if the
peer has disconnected?

When using the socket API, recv() will return a length of 0 when the peer
has disconnected. In my own testing, it looks like curl_easy_recv() will
return CURLE_UNSUPPORTED_PROTOCOL (1) in this case, but that does not seem
to be documented anywhere. Is that the correct error code to look for?

Also, rarely, curl_easy_recv() will return CURLE_OK, but set n=0. What does
this mean? Does it also mean the peer has disconnected?

Thank you

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