EldoS | Feel safer!

Software components for data protection, secure storage and transfer

DownloadFiles get stuck or locked

Posted: 07/02/2010 10:53:55
by Purchase Dept (Standard support level)
Joined: 07/02/2010
Posts: 5


I am using this SFTP client's method fdownload files.

try {
SftpClient.DownloadFiles(RemoteDirectory, FilePattern, LocalDirectory, TSBSFTPFileTransferMode.ftmOverwrite, false, TSBSFTPCaseConversion.sccNone, false);
catch (Exception exp)
                //log error

Our code is wrapped in a Windows Service. It works mostly fine, but sometime it will get stuck, as if it entering a infinite loop. I am not certain what's the reason, or if it is indeed a infinite loop. But based on the log, there is a no error log, and no events fired

SftpClient.OnFileOperation += new TElSftpFileOperationEvent(SftpClient_OnFileOperation);
SftpClient.OnKeyValidate += new SBSSHCommon.TSSHKeyValidateEvent(this.SftpClient_OnKeyValidate);
SftpClient.OnAuthenticationSuccess += new SBUtils.TNotifyEvent(this.SftpClient_OnAuthenticationSuccess);
SftpClient.OnCloseConnection += new SBSSHCommon.TSSHCloseConnectionEvent(this.SftpClient_OnCloseConnection);
SftpClient.OnError += new SBSSHCommon.TSSHErrorEvent(this.SftpClient_OnError);
SftpClient.OnAuthenticationFailed += new SBSSHCommon.TSSHAuthenticationFailedEvent(this.SftpClient_OnAuthenticationFailed);

Usually,the FileOperation will be fired, but not in this case.

One additional information, there may be only handful files need to be download, but some of them are 2G bytes. Not sure that's the reason, though. Thanks for the help.

Posted: 07/02/2010 11:07:17
by Ken Ivanov (Team)

Thank you for contacting us.

Hmm, could the hangup be just a time-consuming download of a huge file? Please handle the OnProgress event, it will help to check whether the component is actually being busy downloading the file.
Posted: 07/02/2010 11:08:12
by Eugene Mayevski (Team)

First, set SocketTimeout property to 30000 (30 seconds) - this will prevent the component from the infinite waiting. You will receive timeout error, but at least the code won't wait for hours and you will be able to restart transmission of the files.

Now, is the process stuck in the middle (i.e. some files have been downloaded and others have not) or always in the very beginning?

Sincerely yours
Eugene Mayevski
Posted: 07/28/2010 15:24:08
by Purchase Dept (Standard support level)
Joined: 07/02/2010
Posts: 5

Thanks Guys. Just noticed you guys have replied!

I will try the timeout setting. Upon another look, the process seems hung during this call. I assume the timeout setting works there. Thx

Posted: 07/28/2010 22:57:17
by Ken Ivanov (Team)

According to the symptoms, the issue is likely to have something to do with intermittent network connectivity or server accessibility issues. In any case, setting the timeout will help overcome the hangup.
Posted: 04/23/2012 02:43:26
by Rowena Guevarra (Basic support level)
Joined: 04/23/2012
Posts: 2

I would like to inquire about implementing TElSimpleSFTPClient's DownloadFile in Windows Service. I used the same code implementation in your SimpleSFTPClient program in C#. However, whenever my code hits the DownloadFile line, it keeps on saying
file system operation failed with error
. I also tried adding the following line but still it didn't work:
SftpClient.AutoAdjustTransferBlock = false;
SftpClient.PipelineLength = 1;
SftpClient.DownloadBlockSize = 32768;

Also, I've noticed that the code works in Windows Form but not in Windows Service. Please advice. Thanks.

[ Download ]
Posted: 04/23/2012 03:04:10
by Eugene Mayevski (Team)

The message is self-explaining: the file could not be accessed by the service. Most likely the account under which the service is run doesn't have enough permissions to access "\\xxx.xxx.xxx\trans\abc.txt". Normally Windows services don't have access to network shares.

What you can do is create a file stream yourself and replace DownloadFile with DownloadStream. This will show you that the problem is in file stream creation.

Sincerely yours
Eugene Mayevski
Posted: 04/23/2012 22:04:06
by Rowena Guevarra (Basic support level)
Joined: 04/23/2012
Posts: 2

Eugene Mayevski,
Thanks Eugene! :) I'm able to resolve my problem and my service is now working. Thank you so much for your help.



Topic viewed 1603 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!