0 votes
by (120 points)
edited

Is there an example in your distribution that uses the new IFtp interface?

Thanks in advance, Jon

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (147k points)
edited

Not yet - we will add one in the next release when the IFtp interface is feature complete. Sorry!

In the meantime, a code like this can be used to initialize IFtp with either FTP or SFTP:

IFtp ftp;
if (UseFtp)
{
    // FTP-specific code
    Ftp tmpFtp = new Ftp();
    ftp = tmpFtp;
    tmpFtp.Connect(...);
    tmpFtp.Login(...);
}
else if (UseSftp)
{
    // SFTP-specific code
    Sftp tmpFtp = new Sftp();
    ftp = tmpFtp;
    tmpFtp.Connect(...);
    tmpFtp.Login(...);
}
else
{
    throw new MyException(...);
}

// at this point, a code that uses the "ftp" object will work with both FTP and SFTP.
ftp.ChangeDirectory("/upload");
...
...