環境:
ftp服務器上存在/A/B目錄,目錄下有個文件夾ABC,向獲取ftp服務器上文件夾ABC下的文件列表
代碼:在irb上測試
require 'net/ftp'
ftp = Net::FTP.open("200.200.0.3","test","test")
ftp.voidcmd("CWD /A/B")
ftp.nlst("ABC")-------这里报错:
報錯內容
irb(main):234:0* ftp.nlst("ABC")
SocketError: getnameinfo: ����������������������
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:1083:in `addr'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:1083:in `block (2levels) in <class:BufferedSocket>'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:383:in `makeport'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:421:in `transfercmd'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:514:in `block (2 levels) in retrlines'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:199:in `with_binary'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:512:in `block in retrlines'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:511:in `retrlines'
from D:/Sangfor-ATT/Ruby200/lib/ruby/2.0.0/net/ftp.rb:744:in `nlst'
from (irb):234
from D:/Sangfor-ATT/Ruby200/bin/irb:12:in `<main>'
不知道哪裏出了錯誤,向各位大牛求教
我知道啊,要不要來問我