cURL / Mailing Lists / curl-library / Single Mail

curl-library

using WSAEventSelect with curl multi

From: Oran Agra <oran_at_monfort.co.il>
Date: Tue, 01 Dec 2009 14:33:00 +0200

Hi all,
I'm trying to use cURL multi on Windows Mobile.
Both easy and multi work well in blocking mode.

I'm trying to create a worker thread that can handle multiple transfers, and receive commends (like quit) from other threads.

I've started with portions of the fopen.c sample that comes with curl, which uses curl_multi_fdset, select, and then curl_multi_perform.

I figured I need to replace the curl_multi_fdset+select with a WaitForMultipleObjects, and use WSAEventSelect to associate the socket with an event.

I thought I need to use curl_multi_setopt with CURLMOPT_SOCKETFUNCTION and maybe also with CURLMOPT_TIMERFUNCTION, the first of which (according to my understanding should give me a socket handle after the socket is created so that I can call WSAEventSelect).

I soon discovered that the CURLMOPT_SOCKETFUNCTION callback isn't called at all when using curl_multi_perform, and searching in the samples I saw the only samples that use this callback are using curl_multi_socket_all instead (a deprecated function).

I've tried using curl_multi_socket_all instead of curl_multi_perform, and my callback started to happen, but later when I do WaitForMultipleObjects or WSAWaitForMultipleEvents it never goes out from that call.
Btw, the call to WSAEventSelect returned with success.

So my questions are:

What am I doing wrong?

Did anyone ever managed to use curl multi with WSAEventSelect and WaitForMultipleObjects?

Is there a difference approach that I should use to get a thread that handles multiple connections, and receives signals from other threads (on Windows)?

If there a sample code that can show me how to do this?

Thanks.
        Oran.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-01