cURL / Mailing Lists / curl-library / Single Mail


curl_multi_perform() and curl_multi_add_handle

From: Milan KÝŠpek <>
Date: Mon, 14 May 2007 14:49:27 +0200 (CEST)

Hi I have one problem.

I am workning on HTTP client. It sends requests to many servers, but it can send 100 request to one server too. So I do it this way. When I get request, a lookup if I have connection (curl_multi_handle) to this server. If not, I start new thread and in this thread I create new easy_curl, new multi_curl and add easy to multi and than I use select() on this multi, until it ends. When I lookup, that I have connection to this server, I create some data structure and give pointer of it to thread, that serves the right multi_handle. In select() loop I ask if I have some data on input. When there is something I generate new easy handle and add it to multi.

Now the problem: Now the problem, I have request to local host, I start new thread, create easy and multi handle, add easy handle to multi and under select I call perform. Than I get new request to same server. I create data structure and gives pointer of it to the thread. In select loop, It determines that it has new data there. It creates from it new easy_handle and add it to the multi.

  If the first request is still performing, it takes the secon request too and perform it. But when I do this, when the first request was already performed, it takes the second request and do nothing.

Why?? Is it because the server close the connection?? Can I reconect it somehow?? Or do I something other wrong? Please respond

Thanks for your advice
Milan Krapek
Received on 2007-05-14