如何使用vb6中的Microsoft Internet传输控件6.0连接到ftps站点

时间:2013-03-09 12:42:31

标签: vb6 sftp inet

在我现有的visual basic 6应用程序中,我连接到一个ftp站点。现在另一方将协议更改为ftps并将端口更改为22.

我的代码无法正常运行。我得到错误vb FTP运行时错误'35753'“此方法不支持该协议”。

我只更改了代码中的端口和网址

我的旧网址就像是ftp.xxx.com.tr

我将网址更改为

sftps://ftp.xxx.com.tr

我正在尝试使用filezilla连接到同一位置,并将URL更改为sftps://ftp.xxx.com.tr,因此我复制了它。 stackover(Transfer PDF file to ftp server in MS access 2007)中有类似的问题,但ftps没有。这是我的代码

    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

感谢您的时间, Ferda

1 个答案:

答案 0 :(得分:1)

我使用psftp作为 - wqw(3月11日13:53)建议他的评论。这是我的新代码。

这是我的脚本文件

    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

就是这样。

感谢您的帮助。

Ferda

相关问题