cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Using libcurl for async operations: Cannot use callback write function

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 18 Aug 2004 13:21:56 +0200 (CEST)

On Wed, 18 Aug 2004, Shaul Eizikovich wrote:

> Well, I want to return ASAP from this function, letting the transfer work in
> the background. I probably miss something.

I think you do miss one vital part:

You need to keep calling curl_multi_perform() to make things get transferred.
If you don't call it, nothing gets transferred. Every time you call it, a
piece of the transfer is made (if there's anything to do at that time).

The function returns CURLM_CALL_MULTI_PERFORM only if you should call it again
before you do select(), but you should always keep calling it until the
transfer is done. Preferably after waiting for action with select().

If you want stuff to happen "in the background", you need to start a new
thread and do the transfer there.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-08-18