FTP Version to Use

+1 vote
asked Mar 10, 2010 by Carl Mitchell (150 points)
edited Aug 10, 2010

I am a novice with secure FTP. I am developing a Windows application in VS-2008 with framework 3.5 and need to download and upload files. From what I am told is this will be to/from an SSH FTP server running on either port 21 or 22 -- can't recall right now.

I'll need to get file size so I can compare it to the downloaded file's size unless there is a better way to do it.

I understand that there is a login and password for the FTP site and that I will need to supply a public key (private key?) supplied to me by the site administrator.

I need to know which package would be best to download and later purchase. I would like to keep this as simple as possible

Any advice would be most appreciated.

Carl Mitchell GasAmerica Services carl.mitchell@gasamerica.com.

1 Answer

+1 vote
answered Mar 11, 2010 by Lukas Matyska (47,950 points)
edited Mar 11, 2010

Hello,

To understand the differences between FTPS and SFTP protocols please visit our Secure FTP disambiguation page. FTPS is supported by Rebex FTP/SSL component, SFTP is suported by Rebex SFTP component. Both feature a similar API and are also available as a bundle - Rebex File Transfer Pack

How to connect and login using the Ftp or Sftp class respectively is described in the FTPS tutorial or SFTP tutorial respectively.

How to authenticate with a client certificate using the Ftp class is described in the FTPS tutorial How to authenticate with a public key using the Sftp class is described in the SFTP tutorial

This is how to get file length of the remote file using Ftp class:

Ftp client = new Ftp();
// ... connect and login ... 
// get file length
long fileLength = client.GetFileLength(remotePath);

This is how to get file length of the remote file using Sftp class:

Sftp client = new Sftp();
// ... connect and login ...
// get file info
SftpItem item = client.GetInfo(remotePath);
// get file length
long fileLength = item.Size;
...