Maybe you are blowing off the maximum number of concurrent downloads. All threads are downloading concurrently.
This is good, except that your DownloadItem calls does not have a safe guard. Suppose someone passes an array list of thousands of files to download.
I would make an app.config file that would contain a value for the maximum of concurrent downloads, and queue the rest of the items to download.
If you allow me to point out, don't use the System.Threading.Thread class to perform a job which terminates the thread when done, like downloading a file. Consider using the BackgroundWorker[^] class or asynchronous programming using delegates[^] (BackgroundWorker would be my choice here).
The main advantage of the above is that the runtime uses a thread from a thread pool it secretly manages for you, so you don't have the overhead of starting/managing your threads.
If atheism is a religion, then not collecting stamps is a hobby. -- Unknown
God is the only being who, to rule, does not need to exist. -- Charles Baudelaire
I am facing a strange issue and i am working on this issue for last one week,but i am not able to find it.I have a window service which reads the MSMQ .This windows service will do only this function.Now, when some thing is written to MSMQ, window service will read the msmq.Now there is nothing in queue ,then also it will loop and if some thing comes inside the msmq then again it will read ...this works fine if i am doing in regular intervals.
Now if am not doing any operations for two or three hours ,then status of windows service will be started but it will not reading the msmq,and it is not throwing any error..also...this is the strange thing i am facing..why it is behaving like this.Can any one help me in this idea.I am pasting the start section of of mywindows service here .can any one tell me what is wrong in this code.Thanks in advance
I have, after alot of hard work, finally got this to work - well.... almost
I have a remoting server using TCPChannel. And i got some clients connecting to this server. When i from the beginning connects 3 client, all works fine, when someone connects, the server sends events to each client that they should update their list of clients. But when one of them Disconnects with this code:
if (SignedIn)<br />
server.SignOut(MyUniqueID); //Removes him from the array of clients<br />
And then siqns in again, he's not getting the event when someone connects or disconnects, but the other clients does, even when the failing client connects/disconnects. BUT if i close this one client that fails, and open it up again, it all work just fine again, very strange.
I got a very simple and clean example code if anyone wants to help me
The use of tcp connections within the same machine can do unexpected things. Without careful scrutiny, I would suggest that there is something you do when the client starts that you don't do when it reconnects. Hence, the problem you see. And the "something different" might be in the remoting set-up.
can anyone illustrate a step by step procedure for using resource manager or some equvalent in C#.
I am not able to embed the main assembly resource file, .resources, in
the executable assembly.So please guide me in creating and embedding resource files as well.
1) Have you meassured a performance problem or are you simply expecting it? Unless you do something strange I doubt you will notice any performance differences between the various ways of writing to files.
2) If you have performance problems are you sure it is not in the disk IO system instead of your code? If it is, get faster disks or more memory for diskcache, or start collecting changes in memory and write them in batches (possible on a worker thread, but then you must take care of locking etc).
Besides this it is not easy to help you when you do not provide more information on what you are trying to write and for what purpose.