cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to pause ftp upload?

From: m. allan noah <kitno455_at_gmail.com>
Date: Tue, 26 May 2009 17:45:31 -0400

On Tue, May 26, 2009 at 5:28 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Tue, 26 May 2009, m. allan noah wrote:
>
>> I'm trying to upload data to two ftp:// urls concurrently using the
>> easy interface.
>
> In two different threads then I presume?

ah, no. I was hoping that pausing each transfer would let me work on the other.

>> The data for both files comes interlaced from a single source, and is
>> produced more slowly than libcurl calls the read callback. The computer does
>> not have enough memory to buffer all of the data prior to transmit, and
>> there is no disk to spool it to temporarily.
>
> And just having the callbacks wait until they have some data to return is
> not fine enough?
>
>> What i would like to do is to feed data to each handle as I get it, and
>> tell the handle to send that data.
>
> That's not very easily done with the easy interface. I would claim the multi
> interface fits that way of thinking better. And if you used multi, you could
> even do this without using threads.

I have already started a multi interface version, and it does work
better, but it's async nature means some changes to my code, since I
was hoping to fill and then drain a small buffer serially.

>> I think I can do it with repeated connections and appending, but the data
>> does not come slowly enough to warrant that kind of overhead. I tried using
>> CURL_READFUNC_PAUSE, but that seems to just hang the program.
>
> Uh? It passes the reading, so that will of course in a sense "hang" the
> program. But you must then unpause it again when you have data you want to
> send. Did you?

If you are using a single threaded program, there is nothing to un-pause you?

allan

-- 
"The truth is an offense, but not a sin"
Received on 2009-05-26