cURL / Mailing Lists / curl-library / Single Mail


how to reduce the number of TCP session generated by an FTP download using libcurl

From: Maurice Lemarin <>
Date: Sun, 23 Oct 2016 20:38:49 +0200


I have checked the mailing-list archive but could not find similar
problem/solution, so I ask ...

I need to read portions of a remote large file using FTP and seek at a
different offset in that file for each new portion read.

The easy interface is not adapted to that, so I used the multi interface
of libcurl and it works well, no problem. But when I capture the network
exchanges, I see of course a lot of TCP data session as expected, but
also a lot of FTP control session one after the other, while a single
one should be sufficient to my understanding. So maybe I'm doing
something wrong:

If I keep the easy handle added in the multi handle while I modify the
CURLOPT_RESUME_FROM_LARGE option on the easy handle, the new offset for
the next read is not taken into account. So what I do is to first to
curl_multi_remove_handle() then modify the easy handle with
CURLOPT_RESUME_FROM_LARGE then curl_multi_add_handle() back the easy handle.

Am I doing something wrong? Is there a way to keep the same control
session by doing another way or using options I missed seeing on the
easy or multi handles?

Thanks for your help,

List admin:
Received on 2016-10-23