Sometimes curl closes a socket before notifying user via SOCKETFUNCTION. I caught this in a case when I want to terminate a transfer in the middle of downloading.
See attached source. I'd expect fcntl() don't fail. If it doesn't work (i.e. doesn't report fcntl error), change the URL to a bigger resource.
I'd like to let curl close its sockets, but I need to get CURL_POLL_REMOVE message when socket is still alive. Otherwise my network reactor goes crazy.