cURL / Mailing Lists / curl-library / Single Mail


Re: curl_easy_cleanup Not Closing Connections

From: Linus Nielsen Feltzing <>
Date: Wed, 20 Feb 2013 14:25:16 +0100

On 02/20/2013 11:36 AM, François Veyres wrote:
> That's not how I understood the behaviour... From the
> curl_easy_cleanup() manpage, "This will effectively close all
> connections this handle has used and possibly has kept open until now."

Ooops. I don't think that applies when you have used the handle with the
multi interface. I'll have to check that, and perhaps update the

> In my case there will be 100's of thousands of clients, each doing
> multiple FTP gets, so I want the control connection to persist but I
> can't afford to keep it open when the transfers are done. I tried
> setting CURLOPT_FORBID_REUSE = 1 after the last transfer but before
> calling curl_easy_cleanup() but that didn't close the control connection.
> So is there a way for me to immediately close the connection after I'm
> finished my transfers?

Hmm, CURLOPT_FORBID_REUSE should be set before the transfer, not after.
But if you do, it will reopen the control channel for every transfer.
Not a good idea, sorry...

I think your best option is to close the multi interface with
curl_multi_cleanup() when you are done.

List admin:
Received on 2013-02-20