cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to pause ftp upload?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 26 May 2009 23:28:32 +0200 (CEST)

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?

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

-- 
  / daniel.haxx.se
Received on 2009-05-26