[Mono-list] Problem with downloading files in Threads

Felipe Almeida Lessa felipe.lessa at gmail.com
Tue Dec 26 09:13:56 EST 2006


On 12/26/06, Robert Jordan <robertj at gmx.net> wrote:
> Sebastian Pölsterl wrote:
> > Unfortunatly, if I have 3 files that should be downloaded the last Thread
> > never terminates. Whereas, I download 1 or 2 files everything works fine.
>
> According to the HTTP RFC, a client must not maintain more than
> 2 open connections to the server. WebClient is respecting this
> restriction.

Maybe he has another problem. He's creating a WebRequest/WebResponse
pair and is never closing it. In fact, he's not even using it, he's
just taking the file size. So for each file it creates two connections
to the same server, being one not closed in the end, so in practice
(with his code) only one download per server can be done concurrently.
Am I right?

Try not using WebClient (as it's just sugar on WebRequest), see the
attached file (which works here).

Cheers,

-- 
Felipe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlme.cs
Type: text/x-csharp
Size: 3731 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-list/attachments/20061226/0b4b1732/attachment.bin 


More information about the Mono-list mailing list