How to connect to ftps site using microsoft internet transfer control 6.0 in vb6

StackOverflow https://stackoverflow.com/questions/15310795

  •  18-03-2022
  •  | 
  •  

Frage

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

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top