By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,165 Members | 1,908 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,165 IT Pros & Developers. It's quick & easy.

Using threads to run multiple processes at Startup

P: n/a
IT
I want to fire off threads to start retrieving File from several locations.
FTP and the local network. Is it ok to start these threads on the main form
load.

Ex.
Every day we load EDI files into a SQL server. When the main form start out
can I have a thread run this process and disable the menu item so that the
user does not try to load the files until they are all downloaded. And is it
ok to disable the dispose method of the form until all transfers are
complete?

I have tried using a service to process this but it need to be setup to run
under a local user account which is the only way I can get it to hit network
shares.

Any suggestions on a better way. I chose to go the way of a service to
prevent user error when FTPing files and handling all the file movement so
all they have to do is generate the reports. The more steps I can take away
from the end-user, the less errors.

Thanks,
Phil
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi

Operating System execute program based on process, and in every process, we
may have at least one thread.
That is to say, if we create a process in thread, a new process will be
started and the code will run in that process's main thread.

So one approach I think is to pull the code about the ftp and then paste
them in the current program, and we can spawn a few threads to run the ftp
code and try catch the exception in the thread and write the error log into
a file or else. In this way, the main program can be a windows program if
your program will involve UI, or be a windows service.

If use the ftp code in another process, the thread start the process can
catch the exception in that process, because windows SEH is based on
thread. In this way, the error handle must be done in that process(which do
the ftp job). In the current program have no idea about what have happened
in that process by default, except that we have used the IPC to tell the
main program.

If you still have any concern, please feel free to post here.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.