cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: async IO using libCURL

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 11 Aug 2010 19:15:20 +0200 (CEST)

On Wed, 11 Aug 2010, Isaac Jurado wrote:

> I've been reviewing the libcurl multi functions several times and I'm unable
> to grasp how I could integrate CURL with my custom event loop. The main
> obstacle is how to obtain the socket descriptor from a CURL easy handle.

You need to use the multi_socket API. It is designed to export the sockets
libcurl use and to allow you to do all the event and socket handling.

See http://curl.haxx.se/libcurl/c/curl_multi_socket_action.html

> Having a CURLMOPT_SOCKETFUNCTION does not seem to solve the problem as it is
> only invoked with curl_multi_socket_action, where you already need to know
> the descriptor.

No, you can also call it as a timeout (see the man page for details on how),
which you can/should do as a first call to get it going the first time.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-08-11