curl-library
Re: Basic usage - easy vs multi in multithreaded application
Date: Fri, 15 Sep 2006 12:57:39 -0400
Juan Manuel Lopez Baio wrote:
> Hello All,
>
> I'm a brand new libcurl user. I'm going to integrate some of its
> functionality in an already existing system, and after reading the
> tutorial, some of the doc and a few example source files, I have a
> question:
>
> the application which I'm developing (BTW: C++, Linux) acts as a
> server for other apps, and eventually may need to provide some file
> transfers between workstations, which is what I chose curl for.
> The thing is that, obviously, my server shouldn't block during transfers.
> I'm not quite sure of this, so correct if I'm wrong: using the multi
> interface, I would get non-blocking behaviour (through non-blocking
> sockets) by default?
> If so, would there be any significant disadvantage if I preferred to
> use the easy interface (which I understand, does block), encapsulating
> it in a class that would handle multiple transfers in its own threads?
> I ask this because there's probably a few common ways to do this with
> Curl that more experienced users may point out.
To the best of my understanding you have it right. You can use the easy
API in a threaded environment (one handle per thread) or the multi in a
single-threaded environment. There's nothing wrong with either way, it's
a matter of personal preference.
MB
Received on 2006-09-15