Is there a version of the library that has a common interface for Ftp and for Sftp. I need to toggle between the two in a library however because I don't see a common interface, I essentially have to duplicate all the code, with exactly the same calls.

asked 12 Jul '10, 18:58

Akshay's gravatar image

Akshay
261
accept rate: 0%


We are planning to release a Remote File System which is exactly what you want. It wasn’t officially released yet, but you can download a preview from http://www.rebex.net/extras/RFS.ConsoleSample.zip

link

answered 13 Jul '10, 13:38

Lukas%20Matyska's gravatar image

Lukas Matyska ♦♦
78217
accept rate: 27%

Thanks, I will take a look.

(28 Jul '10, 14:32) Akshay

We browsed through the new common RemoteFileSystem which is shared with Ftp and SFtp, however we noticed that the calls differ from what is currently on both of those.

At the moment to get around the problem, since both use the same method calls, we're using C#'s dynamic variables and in the new RemoteFileSystem, we'd have to change all of our method calls. Since all the calls are shared, could the API remain the same?

(28 Jul '10, 14:36) Akshay

Which calls do you mean? Could you post their names? Some methods are missing from RemoteFileSystem and some are different, but some of this can't be changed - for example, Rebex FTP's GetList returns an instance of FtpList while SFTP's GetList returns SftpItemCollection - these classes are very similar but not identical. Therefore the common API's GetList must return something else (although it will probably be a common ancestor of both FtpList and SftpItemCollection. The same applies to some other methods, properties and events.

(29 Jul '10, 11:25) Lukas Pokorny ♦♦

To sum it up: please do let us know what exactly which calls were missing, different or otherwise problematic. The common API is a work in progress and we might be able to do something about this issue. Thanks!

(29 Jul '10, 11:26) Lukas Pokorny ♦♦

I notice that the original question was answered over a year ago. Do you now have the Remote File System completed, or if not will you soon? We need to switch back and forth between ftp and sftp as well.

link

answered 04 Oct '11, 18:16

cdbivfs74's gravatar image

cdbivfs74
151
accept rate: 0%

The common interface for FTP and SFTP is already implemented. It will be available within the next public release. You will be able to use new IFtp interface for common functions as follows:

// declare common interface
IFtp client;

// the protocol to use
if (UseFtp)
{
    Ftp ftp = new Ftp();
    ftp.Connect(...);
    ftp.Login(...);
    client = ftp;
}
else
{
    Sftp sftp = new Sftp();
    sftp.Connect(...);
    sftp.Login(...);
    client = sftp;
}

// do some work
client.ChangeDirectory(...);
client.GetFile(...);

If you want to get the trial beta version, please let us know.

(05 Oct '11, 15:17) Lukas Matyska ♦♦

When you get a directory listing will there be a common object for both ftp and sftp for the list collection and its items?

(05 Oct '11, 15:33) cdbivfs74

Yes, there will be the DirectoryItemCollection class which is ancestor of FtpCollection and SftpCollection. It will contain the DirectoryItem objects (ancestor of FtpItem and SftpItem). The code can look like this:

IFtp client = ...;
DirectoryItemCollection list = client.GetList();
foreach (DirectoryItem item in list)
{
    Console.WriteLine("{0} {1} ...", item.Name, item.Length, item...);
}

Please note, the DirectoryItemCollection and the DirectoryItem are not final names. They will be probably renamed.

(05 Oct '11, 15:47) Lukas Matyska ♦♦

Sounds good, we're looking to implement something ASAP, so when is your public release of this scheduled?

(05 Oct '11, 15:56) cdbivfs74

The next public release is scheduled for November 2011. I can send you beta version if you want to try the common API.

(05 Oct '11, 16:01) Lukas Matyska ♦♦

I've got the current trial version from the website, but I'd love to get the beta with the common interface, since this is exactly what I need to do as well.

(08 Oct '11, 05:03) asherber
showing 5 of 6 show 1 more comments
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×136
×115
×1

Asked: 12 Jul '10, 18:58

Seen: 357 times

Last updated: 10 Oct '11, 17:17