欢迎各位兄弟 发布技术文章
这里的技术是共享的
The Passive property controls whether data connections for uploads/downloads are established in Active or Passive mode. To use Active mode, set the Passive property = 0. This is the default. To use Passive mode, set the Passive property = 1.
Active Mode:
The FTP client chooses a port number and sends a “PORT” command to the FTP server. The FTP client then listens at the chosen port and the FTP server issues a connect request to establish the connection. The data connection is outgoing from the FTP server, and incoming to the FTP client.
Passive Mode:
The FTP client sends a PASV command to the FTP server. The FTP server chooses a port number and sends it in the PASV response. The FTP server then listens at that port for the incoming connect request from the FTP client. The data connection is incoming to the FTP server, and outgoing from the FTP client.
Chilkat ActiveX Downloads
Dim fso, outFile Set fso = CreateObject("Scripting.FileSystemObject") Set outFile = fso.CreateTextFile("output.txt", True) ' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. set ftp = CreateObject("Chilkat_9_5_0.Ftp2") ftp.Hostname = "ftp.something.com" ftp.Username = "test" ftp.Password = "test" ' Connect and login to the FTP server. success = ftp.Connect() If (success <> 1) Then outFile.WriteLine(ftp.LastErrorText) WScript.Quit End If ' To use Passive mode: ftp.Passive = 1 ' or... ' To use Active mode: ftp.Passive = 0 ' .. outFile.Close
来自 https://www.example-code.com/vbscript/ftp_active_passive_mode.asp
Hi,
I just find a workarround calling to a Bat file in which work curl fine.
Why did not work it in VBS?
2011/5/29 Raul <raul.frutos_at_gmail.com>
> Hi,
>
> I am working in a VBS script in which one of the task is to connect to a
> ftp server, get the list of the files and keep this info in an local ouput
> file.
>
> It is very strange because it works from command line but it does not from
> my script.
>
> This is the code:
>
> Dim oShell
> Dim returnResult
> Set oShell = WScript.CreateObject ("WScript.Shell")
> returnResult = oShell.run("curl -l ftp://user:password@IP:21/test
> >>d:\tmp.txt, 1,True)
> Set oShell = Nothing
> msgbox returnResult
>
> It shows me in the display the list of files but it doesn´t create the
> file.
>
> The result is a Error code 6:
> curl: (6) Could not resolve host: >>; No data record of requested type
>
> However, if I copy/paste the same line "Curl -l ftp://user:password@IP:21/test
> >>d:\tmp.txt" in command line, it works and it creates the file!
>
> At the begining I thought that the problem was in my script, but if I try
> the same thing with a comand line tool like "ping" it works from my script,
> so it creates the file!!!
>
> Could you please help me! I am not sure if the problem is in Curl or in my
> Script.
>
> Cheers
>
>
>
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-05-29
来自 https://curl.se/mail/archive-2011-05/0050.html