Re: how to determine errors using multi/easy handles?
Date: Sat, 7 May 2005 23:29:55 +0200 (CEST)
On Sat, 7 May 2005, Big Feet wrote:
> Just a few things are not clear. I'd like to know if a dns lookup failed.
> How can I tell?
> Also... how can I tell if some other error happened (some non - result code
> type error)... like what if the transfer is interrupted mid-way through the
> load? What if the load is timed out mid-way? There doesn't seem to be any
> call to determine if a load simply succeeded or failed.
> curl_multi_info_read returns a structure where the msg field can only be
> DONE... but done doesn't tell me what happened... know what I mean?
See http://curl.haxx.se/libcurl/c/libcurl-multi.html, or run 'man
libcurl-multi'. A short quote:
To get information about completed transfers, to figure out success or not
and similar, curl_multi_info_read(3) should be called. It can return a
message about a current or previous transfer. Repeated invokes of the
function get more messages until the message queue is empty. The information
you receive there includes an easy handle pointer which you may use to
identify which easy handle the information regards.
The multi-app.c is even a rough example using it:
> And one other completely different question... The docs say that calling
> curl_multi_remove_handle will cause a transfer to abort. Is this a safe way
> to abort a transfer?
It is supposed to be. Please go ahead and try it and report any problems!
> Would I be able to call curl_easy_cleanup imedately after this call? What
> if the perform calls are being called from a different thread than the one
> that is calling curl_multi_remove_handle & curl_easy_cleanup...
Then I must refer you to the docs again and then especially the sections about
using libcurl in multi-threaded apps. I can sum it up for you:
Never EVER share easy or multi handles between multiple threads.
The only (slightly limited) way you can share libcurl data between threads is
by using the share interface: http://curl.haxx.se/libcurl/c/libcurl-share.html
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2005-05-07