Rebex File Transfer Pack
SFTP/FTP client, SFTP/SSH server libraries for .NET
Download 30-day free trial Buy from $699Save 33% by buying bundle (Purchased individually: $1047)
More .NET libraries
-
Rebex SSH Pack
SSH Shell and SFTP together
-
Rebex Total Pack
All Rebex .NET libraries together
Back to feature list...
File Transfer Client: Overview
On this page:
Universal FTP/SFTP client overview
-
One class for SFTP, FTP and FTPS protocols
No need to write similar code twice code when you want your application to use both FTP and SFTP.
-
Easy to connect to both SFTP and FTP servers
SFTP, plain unencrypted FTP, implicit or explicit FTP over TLS/TLS (FTPS) - all connection methods are handled. All common FTP and SFTP authentication methods are included as well.
See details on connecting and authentication with FileTransferClient.
-
Write multiprotocol code using IFtp interface
File upload, download, directory creating and more. All what's common for FTP and SFTP is accessible using an IFtp interface implementation.
-
Access to underlying SFTP/FTP object when needed
Want to do FTP server-to-server transfer? Want to reuse and existing SSH session for password changing? Underlying object are easily accessible.
See it in action
// get connected and authenticated FTP or SFTP object
var client = new FileTransferClient();
// client.Connect(hostname, FileTransferMode.Ftp) // FTP
// client.Connect(hostname, FileTransferMode.FtpSslImplicit) // FTP/SSL
client.Connect(hostname, FileTransferMode.Sftp); // connect to SFTP
// the remaining code works with both FTP and SFTP sessions
// authenticate
client.Login(username, password);
// do some work
client.ChangeDirectory(targetDirectory);
client.PutFile(@"C:\MyData\file.txt", "file.txt");
// say goodbye
client.Disconnect();
' get connected and authenticated FTP or SFTP object
Dim client = New FileTransferClient()
' client.Connect(hostname, FileTransferMode.Ftp) ' FTP
' client.Connect(hostname, FileTransferMode.FtpSslImplicit) ' FTP/SSL
client.Connect(hostname, FileTransferMode.Sftp) ' connect to SFTP
' the remaining code works with both FTP and SFTP sessions
' authenticate
client.Login(username, password)
' do some work
client.ChangeDirectory(targetDirectory)
client.PutFile("C:\MyData\file.txt", "file.txt")
' say goodbye
client.Disconnect()
IFtp interface - Protocol agnostic file transfer API
IFtp
interface supports most Ftp
and Sftp
methods, events and properties.
IFtp is implemented in FileTransferClient, Sftp and Ftp classes.
What's included:
Upload
andDownload
for transferring files and directories.- Single-file
PutFile
andGetFile
methods. - Directory listing retrieval using
GetList
(simple) orGetItems
(advanced). - Managing files and directories using
CreateDirectory
,Rename
,SetFileDateTime
, and many more. - Bandwidth throttling using
MaxUploadSpeed
andMaxDownloadSpeed
properties. - Operation events (
TransferProgressChanged
,ListItemReceived
etc.) - Task-based Asynchronous Pattern methods are available as well.
- Getting file checksums for both local and remote files.
IFtp
methods, events and properties, see IFtp reference guide.
Working with underlying SFTP/FTP object
Sometimes you have to use a feature available only in one protocol.
You can access underlying Sftp
or Ftp
object using the FileTransferClient.Inner
property.
var client = new FileTransferClient();
client.Connect(hostname, FileTransferMode.Ftp);
// send the custom FTP command using the inner Ftp object
// "FEAT" returns a list of server features
Ftp ftp = client.Inner as Ftp;
ftp.SendCommand("FEAT");
// read the response
var response = ftp.ReadResponse();
Console.WriteLine(response.Raw);
Dim client = New FileTransferClient()
client.Connect(hostname, FileTransferMode.Ftp)
' send the custom FTP command using the inner Ftp object
' "FEAT" returns a list of server features
Dim ftp As Ftp = TryCast(client.Inner, Ftp)
ftp.SendCommand("FEAT")
' read the response
Dim response = ftp.ReadResponse()
Console.WriteLine(response.Raw)
Back to feature list...