cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Libcurl Multi-Environment Timing Problems

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 9 Jul 2010 22:30:11 +0200 (CEST)

On Fri, 9 Jul 2010, Paul Romero wrote:

>> If you use curl_multi_perform() you don't want/need libevent. If you want
>> libevent-style processing, you don't use curl_multi_perform().
>
> OK, I believe you. What alternative routine do you suggest which does not
> rely upon the libevent library and FIFOs ?

I'd suggest you first use the regular libcurl multi interface and get an
understanding for how it works before you try more advanced or special
approaches.

> 1) Send a single file between my system and another via SFTP.
> 2) Perform the transaction asynchronously so that my program
> can do other things during the file transfer.

That's what the multi interface already provides. You just need to understand
that asynchronous means non-blocking, so it won't complete anything in the
background or so. You will need to call libcurl over and over until the
transfer is complete. An example showing a single transfer done non-blocking
is here: http://curl.haxx.se/libcurl/c/multi-single.html

> Ideally, it would be possible to invoke a routine to start the file
> transfer, and a handler indicating the outcome would execute when it is
> complete. However, that may not be a reasonable expectation. I would expect
> the library has some way to inform a program when data can be sent and the
> program needs some code to respond to the notification.

If you want something to deal with the entire transfer and then tell you when
its done, then you need to do that transfer in a separate thread and then I'd
say it would make sense to just use the easy interface there.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-07-09