I've been reading some things about threading, delegates, threadpools, locks,
etc... yet I can't quite seem to grasp some of the concepts on it quite yet.
I'm currently working on a project I need a little threading help with.
For this question's sake, I have 3 objects:
1) A main form where I search directories for certian files.
2) An 'UploadFiles' class which creates an SFTP connection and uploads files
to a specific IP address.
3) A 'ProcessThreads' class (this is where I need help) which I'd like to
use as follows:
Someone presses the transfer files button on the main form. It checks
directories for certain files. If those files are there, it calls
'ProcessThreads.Process'
ProcessThreads.Process creates a new instance of the 'UploadFiles' class for
each IP in a list I store globally (this list changes, so I see this process
being in a loop).
For each instance of the 'UploadFiles.Upload' process, I would like it to
either be in a thread of it's own, or queued in a threadpool so windows can
handle the processing of the threads.
Basically, what I'd like to accomplish is if I had 10 IP addresses to upload
to, I don't want to do them one at a time, instead, several at a time for
whatever windows can handle. Can someone point me in the right direction of
handling a situation like this? Do I have to edit my 'UploadFiles' class to
include the thread in that, or can I just handle the threads in a
'ProcessThreads' class?
Thanks for any help/advice/samples/etc... you all can give.
-Jason