EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Windows Service, Timers, Threads, and SFTP

Posted: 09/07/2010 09:53:29
by Tyson Nero (Basic support level)
Joined: 09/03/2010
Posts: 2

I am writing a Windows Service. In the service there is a timer that fires at a specific interval. Upon firing, the service will scan a directory for files and need to transfer them via SFTP.

If this does not complete before the next interval, the System.Timers.Timer will fire off another thread. Will the Eldos SFTP Client be compatible with multiple threads, or do I need to use a single thread approach as opposed to a Timer?
Posted: 09/07/2010 10:28:21
by Ken Ivanov (Team)

Thank you for contacting us.

There will be no problems with this if
1) Individual instance of TElSimpleSFTPClient is used in every other thread,
2) The server allows several simultaneous connections from a single client.
Posted: 09/07/2010 10:40:11
by Tyson Nero (Basic support level)
Joined: 09/03/2010
Posts: 2

That's great news.

I was thinking that I could rather implement the FileSystemWatcher class to monitor changes and fire off a new instance of TElSimpleSFTPClient per event. I guess the same would apply as long as the server handled simultaneous connections.

If the server only allows single connection, is there any type of waiting I could implement?
Posted: 09/07/2010 10:55:16
by Ken Ivanov (Team)

Well, you can set up a single persistent SFTP connection to server in a separate thread and maintain a queue of files to upload. I.e., once FileSystemWatcher fires giving you a new set of files, you just add them to the queue. TElSimpleSFTPClient's thread, in turn, checks the queue in a loop, uploading all the files available there one by one to server.



Topic viewed 1088 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!