cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bug in libcurl in multithreaded program

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 4 Jun 2002 13:45:27 +0200 (MET DST)

On Mon, 3 Jun 2002, Avery Fay wrote:

> On windows: HTTP and HTTPS work fine regardless of number of threads. FTP
> is ok until about 4 threads or so and then everything grinds nearly to a
> halt.
>
> Anyone have any ideas about this? Has anyone gotten a mulithreaded libcurl
> application on windows doing FTP transfers to preform well?

I haven't heard anyone with these kinds of problems, nor have I ever tried
this myself.

> If there are no suggestions, I'll see if I can whip up a little sample
> program that causes the above mentioned slow transfers.

Would be very useful. Would it be possible to run the program using kind kind
of profiling or something to see where all the time is spent? Using a network
analyzer here could be helpful too, to see if the problem is incoming or
outgoing data or whatever.

> On a different note, I'm interested in using the multi interface but I have
> a question. If I set CURLOPT_WRITEFUNCTION and it is called by libcurl how
> do I know which connection it corresponds to? In a multithreaded
> application I can just do a lookup in a table by the thread ID, but
> obviously in a situation with multiple connections per thread I can't do
> that.

You set a custom pointer with CURLOPT_WRITEDATA to contain whatever you like.
Most likely you make each easy handle's "writedata" point to a unique
instance of a particular struct that you init accordingly. Then the callback
function can easily read from that to identify itself.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
Received on 2002-06-04