cURL / Mailing Lists / curl-library / Single Mail


curl_easy_recv and disconnections

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

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:
Received on 2013-01-14