cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_easy_cleanup and curl-multi

From: <Zibiao.Wei_at_atxinc.com>
Date: Tue, 7 Jun 2005 22:53:40 -0400

I am new to libcurl. My first question is how to reuse curl_easy_handle in
curl_multi.

My test shows I have to follow these steps:
1. Set an url to an easy_handle.
2. Add the easy_handle to multi_handle.
3. curl_multi_perform
4. Remove easy_handle from multi_handle
5. Set another url to the easy_handle.
6. Add easy_handle to multi_handle again
7. curl_multi_perform.

Am I right? Why step 4 and 6 are necessary?

I have reused the same easy_handle through multi_handle to download
multiple files from the same server. Finally I call curl_easy_cleanup to
free resource. My program has no problem.

Then I tried to download an url using an easy_handle through a
multi_handle. If it failed, I would change the url to another mirror
server and use the same easy_handle and multi_handle (remove easy, set new
url, add to multi). This works for me, but when I finally call
curl_easy_cleanup, I got an error:

First-chance exception at 0x0040b0f7 in ATXCommX05.exe: 0xC0000005: Access
violation reading location 0x00000048.

The ATXCommX05.exe is an ATL COM executable. I am using VC++7, static link
to libcurl, run time library is set to Multi-threaded (I tried
Multi-threaded Debug also).

Please help. Thanks a lot.
Bill Wei
ATX II, LLC
207.498.4289 x 40905
Received on 2005-06-08