cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: dose using callback function is synchronic or Asynchronic?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 28 Apr 2008 13:19:18 +0200 (CEST)

On Mon, 28 Apr 2008, Meir Yanovich wrote:

> im doing post and waiting for response from the server and using the curl
> CURLOPT_VERBOSE for debugging now i see it opens connection every time its
> performing the http post and closing it after .

Well, if you re-use the same easy handle it should mostly keep the connection
around and re-use it when you communicate with the same server again.

> the callback function retrieves the server response . but i have no idea if
> it was synchronic or Asynchronic operation .

The callback function is always called synchronously with the rest of the
flow, it is only one thread and thus cannot continue until you return from the
callback!

> my question is how can i determine the the way i what to perform the call
> (synchronic or Asynchronic )

libcurl doesn't really offer asynch transfers, but you can make them
non-blocking with the multi interface.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2008-04-28