IFTP Sample Application

0 votes
asked Mar 13, 2012 by Jon (120 points)
edited Mar 16, 2012

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
answered Mar 16, 2012 by Lukas Pokorny (102,130 points)
edited Mar 16, 2012

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");
...
...