We have not implemented the Connect method in the IFtp interface because of the different nature of SFTP and FTP(/SSL) protocols. I.e. there is no SSL mode in SFTP and there is the rub. So the question would be what SSL mode would be used then? And if you choose one of the variants (implicit/explicit/no SSL mode for FTP), the others would fail.
So the solution would not be universally suitable.
However we are planning to create a class which would be universal for both SFTP and FTP protocols. This would implement the Connect method. We will post here, once it is ready.
Update: The universal SFTP/FTP client class has been released as part of Rebex File Transfer Pack 2014 R2. It implements
IFtp and adds
Meanwhile, could you call the Connect and Login methods just after instantiating the Ftp or Sftp object as in the code below?
public IFtp GetIFtpInstance()
// connect to a server according to its type
// create an instance of Ftp object
var ftp = new Ftp();
// connect and authenticate to an FTP server
// return Ftp instance
// create an instance of Sftp object
var sftp = new Sftp();
// connect and authenticate to an SFTP server
// return Sftp instance
throw new Exception("Invalid server type.");