I wrote a multithreaded web download application, but have found that
the threads are not separated enough.

Two facts.

1) if I run two application instances with 10 threads each, it
downloads faster than one application with 20 threads

2) sometimes downloading from one site, the timeout errors begin to
occur and this state persists until application restart; thread
restarting does not help

My question is: if we suppose, that I didn't make a mistake and have
correctly separated threads, then aren't HttpWebRequest,
HttpWebResponse and Bitmap classes share some static resource?

In each thread I create new objects of HttpWebRequest, HttpWebResponse
and Bitmap classes.

Each thread is created by the following code

cGrabber = new System.ComponentModel.BackgroundWorker();
                cGrabber.WorkerSupportsCancellation = true;
                cGrabber.DoWork += new
System.ComponentModel.DoWorkEventHandler(this.cGrabber_DoWork);
                cGrabber.RunWorkerCompleted += new
System.ComponentModel.RunWorkerCompletedEventHandler
(this.cGrabber_RunWorkerCompleted);

with cGrabber_DoWork and cGrabber_RunWorkerCompleted procedures the
same for all of them.

Reply via email to