curl / Mailing Lists / curl-library / Single Mail


Re: Recovering from dropped connections with multi curl

From: Daniel Stenberg <>
Date: Tue, 14 Mar 2017 23:29:44 +0100 (CET)

On Tue, 14 Mar 2017, doa379 wrote:

> The problem I am having is with dropped internet connections when this
> function is already running. In such situations I would like U = 0 so that
> the main loop ends and the function returns back to its origin. This isn't
> happening. Most of the time after the internet connection is dropped and
> then re-established, the function is stuck in the main while loop with U !=
> 0.

I suppose that's simply because libcurl didn't actually trigger an error for
those cases so all that happened was that when the internet connection
"dropped" your transfers stalled, waiting for the connectivity to come back.
TCP is after all designed to work exactly like that.

If you want to detect that better, you should consider setting
CURLOPT_TCP_KEEPALIVE and/or to use some timeouts like CURLOPT_LOW_SPEED_LIMIT

Received on 2017-03-14