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")
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!
This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
2 posts • Page 1 of 1
- Posts: 12030
- Joined: Thu Oct 11, 2001 1:24 pm
- Display name: Mat (SmartFTP)
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.