EAccessViolation during SFTP file download
Posted: Thu  28 Oct 2010 15:04
				
				I am evaluating the SecureBridge components using C++ Builder 6 to see if it will work for us. I have run into a problem.
When downloading a 25meg file I am getting an EAccessViolation in the middle of the download. If I comment out the RetrieveAttributes line, the download completes successfully.
Is this a bug in the components or am I doing something wrong?
TScSSHClient *SSHClient = new TScSSHClient( this );
TScFileStorage *KeyFileStorage = new TScFileStorage( this );
SSHClient->KeyStorage = KeyFileStorage;
SSHClient->Authentication = atPassword;
SSHClient->Port = 22;
SSHClient->HostName = "xxx";
SSHClient->User = "xxx";
SSHClient->Password = "xxx";
TScSFTPClient *SFTPClient = new TScSFTPClient( this );
SFTPClient->SSHClient = SSHClient;
SFTPClient->Version = vSFTP6;
// Initialize session
SSHClient->Connect();
SFTPClient->Initialize();
// Get the file size
TScSFTPFileAttributes *Attributes = new TScSFTPFileAttributes;
SFTPClient->RetrieveAttributes( Attributes, "/downloadtest.bin", false, TScSFTPAttributes()Size;
delete Attributes;
// Download the file
SFTPClient->DownloadFile("/downloadtest.bin", "c:\downloadtest.bin", true );
// Finish/cleanup
SFTPClient->Disconnect();
SSHClient->Disconnect();
delete SFTPClient;
delete SSHClient;
delete KeyFileStorage;
			When downloading a 25meg file I am getting an EAccessViolation in the middle of the download. If I comment out the RetrieveAttributes line, the download completes successfully.
Is this a bug in the components or am I doing something wrong?
TScSSHClient *SSHClient = new TScSSHClient( this );
TScFileStorage *KeyFileStorage = new TScFileStorage( this );
SSHClient->KeyStorage = KeyFileStorage;
SSHClient->Authentication = atPassword;
SSHClient->Port = 22;
SSHClient->HostName = "xxx";
SSHClient->User = "xxx";
SSHClient->Password = "xxx";
TScSFTPClient *SFTPClient = new TScSFTPClient( this );
SFTPClient->SSHClient = SSHClient;
SFTPClient->Version = vSFTP6;
// Initialize session
SSHClient->Connect();
SFTPClient->Initialize();
// Get the file size
TScSFTPFileAttributes *Attributes = new TScSFTPFileAttributes;
SFTPClient->RetrieveAttributes( Attributes, "/downloadtest.bin", false, TScSFTPAttributes()Size;
delete Attributes;
// Download the file
SFTPClient->DownloadFile("/downloadtest.bin", "c:\downloadtest.bin", true );
// Finish/cleanup
SFTPClient->Disconnect();
SSHClient->Disconnect();
delete SFTPClient;
delete SSHClient;
delete KeyFileStorage;