Rumah > Soal Jawab > teks badan
环境:
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>'
不知道哪里出了错误,向各位大牛求教