I use this code to download a file from a url.
Stream stm = myHttpResponse.GetResponseStream();
byte[] buff = new byte[4096];
Stream fs = new FileStream("c:\\file1.txt", FileMode.Append , FileAccess.Write);
int r = 0;
while((r = stm.Read(buff, 0, buff.Length)) > 0)
{
fs.Write(buff, 0, r);
}
If I want to download 20 files (from different urls) simultaneously it's possible to do it with less than 20 threads?
Edit
HttpWebResponse hasn't async method. I was hoping some example with BeginRead/BeginWrite of streams. I think they dont consume threads from Threadpool