2

我正在尝试使用以下代码使用 Ruby gem double_bag_ftps 连接到 FTPS 服务器。

require 'double_bag_ftps'
ftps = DoubleBagFTPS.new
ftps.ssl_context = DoubleBagFTPS.create_ssl_context(:verify_mode => OpenSSL::SSL::VERIFY_NONE)
ftps.connect('xx.xx.xx.xx')
ftps.login('user', 'password')
files = ftps.nlst
puts files.length

尝试连接时出现以下错误。

/home/indika/.rvm/gems/ruby-1.9.3-p0@global/gems/double-bag-ftps-0.1.0/lib/double_bag_ftps.rb:148:in `connect': Broken pipe - SSL_connect (Errno::EPIPE)
        from /home/msc22/.rvm/gems/ruby-1.9.3-p0@global/gems/double-bag-ftps-0.1.0/lib/double_bag_ftps.rb:148:in `ssl_socket'
        from /home/msc22/.rvm/gems/ruby-1.9.3-p0@global/gems/double-bag-ftps-0.1.0/lib/double_bag_ftps.rb:125:in `transfercmd'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/ftp.rb:478:in `block (2 levels) in retrlines'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/ftp.rb:178:in `with_binary'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/ftp.rb:477:in `block in retrlines'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/ftp.rb:476:in `retrlines'
        from /home/msc22/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/ftp.rb:703:in `nlst'
        from backup_collector.rb:8:in `<main>'

非常感谢您对此的任何帮助。

4

0 回答 0