cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Maurice Lemarin <curl_at_dm3c.org>
Date: Wed, 2 Nov 2016 22:05:19 +0100

>From: Daniel Stenberg
>Date: Sun, 23 Oct 2016 23:28:23 +0200 (CEST)

>On Sun, 23 Oct 2016, Maurice Lemarin wrote:

/>> 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 /

> I don't see how the two interfaces differ in any significant way for
this sort
> of operation.

yes, you are right, thanks. All the problem was about how to read a
small portion of bytes at a given offset from a large file.

I've found how to position the reading at the beginning of the portion
to be read (CURLOPT_RESUME_FROM_LARGE), but failed limiting the amount
of bytes to be read. The only solution I have found to stop the transfer
is either:
- aborting by letting the write callback returning different value than
the provided bytes
- using a multi handler on top and removing the easy handle from the
multi handle

Unfortunately, in both cases, this closes not only the FTP data session
but also the FTP control session. Thus reading a new portion a bit
further in the same file/same server leads to the creation of a new FTP
control session. After having read sequentially several blocks this way
libcurl get bounced by the FTP server because the server limits the
number of FTP (control) connection per second for a given host...

How can I interrupt an operation (read/write data) without having the
FTP control session closed?

Regards,
Maurice

P.S.: I do not receive mails from the mailing-list while my account
options for the mailing-list should let me receive them. Please excuse
the form of my reply, I had to copy and past from the mailing-list archive.

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-11-02