cURL / Mailing Lists / curl-library / Single Mail


Re: multi API q

From: Ben Greear <>
Date: Tue, 27 Nov 2001 08:57:18 -0700

Why don't you do something like:

create HTTP handle
Add handle to multi-main-loop
create FTP handle
Add handle to multi-main-loop
add your own private handle to multi-main-loop
[you get callbacks as your handle has data available]
create HTTP handle
add handle to multi-main-loop
[ftp is done, it is removed, and you get a callback]
create FTP handle
add handle to multi-main-loop

Daniel Stenberg wrote:

> Imagine a working "multi" interface for libcurl. The multi-app.c example code
> is working. Using that code, you can downlad HTTP and upload FTP
> simultaneously while also taking care of your own file descriptors. In one
> single thread.
> Now, a question. Say you want to download several HTTP pages using the http
> handle (while the FTP transfer is still going). How would you go about and do
> that?
> When using the easy interface, you just call curl_easy_perform() again, but
> with the multi interface, there's really no good equivalent way of doing
> that. Using the currently described API (approach A), I figure you'd need
> to:
> 1. Remove the single http handle from the multi stack with
> curl_multi_remove_handle()
> 2. Set new options in the http handle with curl_easy_setopt(), in good old
> style.
> 3. Attach the handle again to the multi stack with curl_multi_add_handle()
> Alternatively, the handle could B) be removed automatically from the stack
> when the transfer is done, or perhaps C) the new options could be set on the
> handle without removing it from the multi stack, only requiring a call to
> some function to let it know the options are updated and that it is ready for
> another run...
> I know this question is very theoritecal and hypothetical, but I still need
> to decide...

Ben Greear <>       <Ben_Greear AT>
President of Candela Technologies Inc
Received on 2001-11-27