2

In my exisiting visual basic 6 application I was connecting to an ftp site. Now the other side changed protocol to ftps and changed the port to 22.

My code do not work properly. I get error vb FTP run-time error '35753' "protocol not supported for this method".

I only changed the port in my code and the url

my old url was like ftp.xxx.com.tr

I changed the url to

sftps://ftp.xxx.com.tr

I am trying to connect to the same location using filezilla and it changes the url to sftps://ftp.xxx.com.tr so I copied it. There are similar questions in stackover (Transfer PDF file to ftp server in MS access 2007) but not for ftps. This is my code

    With xControl
       .AccessType = icDirect
       .Protocol = icFTP
       .RemotePort = 22
       .RequestTimeout = 50
       .url = xURL
       .UserName = xUserName
       .Password = xPassword
       .Cancel
       .Execute , "DIR " & xFileName
        Do While .StillExecuting
           DoEvents: DoEvents: DoEvents
        Loop
        gLogonFtp = "Connected to Host"
   End With

Thank you for your time, Ferda

Community
  • 1
  • 1
Ferda-Ozdemir-Sonmez
  • 674
  • 2
  • 13
  • 38
  • 1
    Microsoft Internet Transfer Control doesn't support either sftp or ftps (http://en.wikipedia.org/wiki/FTPS). You need to find some third party control or use translating bridge (Bitvise) for that. – Arvo Mar 11 '13 at 09:21
  • You have mixed SFTP and FTPS (see the difference here: http://www.eldos.com/sbb/sftp-ftps.net/ftps-vs-sftp.php ) . What you need is SFTP. So you need a third-party component, eg. our SecureBlackbox or other SSH/SFTP client control for VB6. – Eugene Mayevski 'Callback Mar 11 '13 at 12:20
  • 1
    Use `psftp.exe` from [`Putty`](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) -- it's free – wqw Mar 11 '13 at 13:53

1 Answers1

1

I used psftp as – wqw (Mar 11 at 13:53) suggested on his comment. Here is my new code.

This is my script file

    cd to_remotedir
    lcd C:\path2 'local dir
    mget * *
    quit

result = ChangeFileContent("*", xOnlyFileName) //here I change the content of my script file psftpcommand.bat to get a specific file 

Sleep 1000
Shell "C:/path/psftp.exe -v -pw " & xPassword & " " & xUserName & "@" & xURL & ":22 -b C:/path/psftpcommands.bat"
Sleep 1000
 result = ChangeFileContent(xOnlyFileName, "*")//here I rechanged the content of the file. Change file name to ->*

'In the below I check if the requested file has come 
Sleep 1000
If Dir("C:\path2\" & xOnlyFileName) <> "" Then
    gLogonFtp = "Successful"
    frmDataTransfers.lblTransferInfoDownLoad.Caption = "Dosya Çekildi " & xOnlyFileName
    frmDataTransfers.lblTransferInfoDownLoad.Refresh

 End If

That's all.

Thank you for your help.

Ferda

Keith
  • 20,636
  • 11
  • 84
  • 125
Ferda-Ozdemir-Sonmez
  • 674
  • 2
  • 13
  • 38