EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP can't download file but example client can?

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#4503
Posted: 12/16/2007 20:03:26
by Justin H (Basic support level)
Joined: 12/16/2007
Posts: 6

I'm trying to just connect and download a file. The connection works and authenticates successfully.however when it hits the download call it waits a second and then gives me "SFTP component not connected". I've used the example client and it works correctly?? Can someone take a look at this code and tell me what may be wrong. Thanks in advance.

Code
SBUtils.Unit.SetLicenseKey("0190...773A");

TElSimpleSFTPClient SftpClient = new TElSimpleSFTPClient();
SftpClient.Address = values.SFTPHost;
SftpClient.Port = int.Parse(values.SFTPPort);
SftpClient.Username = values.SFTPUsername;
SftpClient.Password = values.SFTPPassword;
SftpClient.AuthenticationTypes = SBSSHConstants.Unit.SSH_AUTH_TYPE_PASSWORD;
SftpClient.Open();
SftpClient.DownloadFile("/PruToAprimo.txt", "c:\\success.txt", SBSftpCommon.TSBSFTPFileTransferMode.ftmOverwrite);
          
#4504
Posted: 12/17/2007 01:09:23
by Ken Ivanov (EldoS Corp.)

Please consider handling the OnError event and checking if it is fired.
#4505
Posted: 12/17/2007 02:28:40
by Eugene Mayevski (EldoS Corp.)

Also, try setting PipelineLength to 1 and UploadBufferSize and DownloadBufferSize to 16384. Some older and buggy servers close connection if they receive data block of over 16K (despite the fact that the minimum required block size is 32K according to specification).


Sincerely yours
Eugene Mayevski
#4508
Posted: 12/17/2007 04:35:59
by Justin H (Basic support level)
Joined: 12/16/2007
Posts: 6

Thank you both, I have tried each of these before to no avail. The OnError does not fire however the OnAuthenticationSuccess and OnKeyValidate do. Setting the pipeline / buffer sizes has no effect. As I mentioned the example client works however the example console app does not?
#4509
Posted: 12/17/2007 06:22:41
by Ken Ivanov (EldoS Corp.)

Quote
Setting the pipeline / buffer sizes has no effect.

Remember that you also need to set AutoAdjustTransferBlock property to false to make ElSimpleSFTPClient use these properties.

Quote
As I mentioned the example client works however the example console app does not?

It is possible that the server does not understand the path to the file being downloaded. Please check that both the working sample and your application pass the same remote file name to the DownloadFile() method.
#4514
Posted: 12/17/2007 14:55:28
by Justin H (Basic support level)
Joined: 12/16/2007
Posts: 6

Thanks for the help guys. Apparently I needed to set the version in the code which is not happening in the console app example but is in your win forms example (why one worked for me and the other did not). After doing this my code worked fine without setting buffer sizes etc. Anyway thank you both for such prompt responses.

~Justin
Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.

Reply

Statistics

Topic viewed 3005 times

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




|

Back to top

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

Got it!