Implementing FTP and SFTP in one application

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
Posts: 16
Joined: Thu Feb 05, 2009 10:24 am

Implementing FTP and SFTP in one application

Post by m.gunesch » Thu Feb 05, 2009 12:00 pm

Hi everybody,

I have a question according to ftp/sftp with SmartFTP-Library.
I'd like to create an VB6 application which can do file transfer via ftp and sftp. This should be controlled via a flag in an ini file.

My question is, what is the best way to do that?
I have already implemented FTP, but now, when I try to use SFTP I have some problems with missing methods or also same function name but different parameters.

ChangeDirectory doensn't exist with SFTP
ftp UploadFile has differnt parameters than sftp UploadFile

I'd like to use the same object and just at time of creation I'd like to decide what I have to create, like this:

If SFTP Then
Set objFTP = CreateObject("sfFTPLib.SFTPConnection")
Set objFTP = CreateObject("sfFTPLib.FTPConnectionSTA")
End If

It would be possible to define 2 different objects, but than I would have to use different ways for e.g. up-/downloading a file??
Or is there a better way to do that?

Thanks in advance!

Bye, Markus

Posts: 12029
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)

Re: Implementing FTP and SFTP in one application

Post by mb » Thu Feb 05, 2009 2:42 pm

You have to make 2 implementations. One for FTP and one for SFTP. The best way is to introduce a new abstraction layer. E.g. create an abstract base class Connection and then implement two concrete classes FTPConnection ans SFTPConnection. However I do not know what OOP features VB6 offers. I strongly recommend to use VB.NET or C# if you have the choice.


Post Reply