Multi-threaded downloader in C# question

Posted by blez on Stack Overflow See other posts from Stack Overflow or by blez
Published on 2010-05-06T10:43:08Z Indexed on 2010/05/06 10:48 UTC
Read the original article Hit count: 230

Currently I have multi-threaded downloader class that uses HttpWebRequest/Response. All works fine, it's super fast, BUT.. the problem is that the data needs to be streamed while it's downloading to another app. That means that it must be streamed in the right order, the first chunk first, and then the next in the queue. Currently my downloader class is sync and Download() returns byte[]. In my async multi-threaded class I make for example, list with 4 empty elements (for slots) and I pass each index of the slot to each thread using the Download() function. That simulates synchronization, but that's not what I need. How should I do the queue thing, to make sure the data is streamed as soon as the first chunk start downloading.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET