我试图使用FTP与被动模式:
require 'net/ftp'
ftp = Net::FTP.new
ftp.passive = true
ftp.connect('mydomain.com')
ftp.login
filenames = ftp.nlst
Run Code Online (Sandbox Code Playgroud)
但是有错误:
Errno::ETIMEDOUT: Connection timed out - connect(2)
Run Code Online (Sandbox Code Playgroud)
虽然有活动模式但它工作正常!
我用ruby 1.9.3.当我设置debuge模式时:
ftp.debug_mode = true
Run Code Online (Sandbox Code Playgroud)
我知道了:
**ftp.connect('mydomain.com')**
connect: mydomain.com, 21
get: 220---------- Welcome to Pure-FTPd [privsep] ----------
get: 220-You are user number 3 of 50 allowed.
get: 220-Local time is now 11:43. Server port: 21.
get: 220-IPv6 connections are also welcome on this server.
get: 220 You will be disconnected after 15 minutes of inactivity.
=> …Run Code Online (Sandbox Code Playgroud)