irb(main):001:0> require "net/ftp"
=> true
irb(main):002:0> ftp = Net::FTP.new
=> #<Net::FTP:0x2bc26b8 @resume=false, @mon_entering_queue=[],
@mon_count=0, @debug_mode=false, @mon_owner=nil, @passive=false,
@mon_waiting_queue=[], @binary=true>
irb(main):003:0> ftp.passive=true
=> true
irb(main):004:0> ftp.connect('ftp.ruby-lang.org')

stolen from here:
http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/8a0325219d6bd231/e1caf28287969de6?lnk=gst&q=ftp+passive&rnum=1#e1caf28287969de6

On 8/25/06, Paul Carvalho <[EMAIL PROTECTED]> wrote:
> Hi there, I have a Ruby question.  I'm trying to ftp through Ruby at work
> (which is behind the corporate firewall) and I'm having difficulty
> understanding what I need to do to get this to work.  The IT guy here said
> that I need to set it to "passive" mode to get it to work, but I can't quite
> figure out how the syntax works.
>
> Here's what I've tried:
> ----
> C:\>irb
> irb(main):001:0> require 'net/ftp'
> => true
>
> irb(main):002:0> Net::FTP.passive
> NoMethodError: undefined method `passive' for Net::FTP:Class
>         from (irb):2
>
> irb(main):005:0> ftp = Net::FTP.new(uri)
> Net::FTPPermError: 530-
> 530-Your hostname cannot be confirmed via the nameserver.
> 530-
> 530-
> 530- -- ACCESS DENIED --
> 530-
> 530-
> 530-
> 530
>
>          from c:/ruby/lib/ruby/1.8/net/ftp.rb:243:in
> `getresp'
>         from c:/ruby/lib/ruby/1.8/net/ftp.rb:251:in
> `voidresp'
>         from c:/ruby/lib/ruby/1.8/net/ftp.rb:176:in
> `connect'
>         from c:/ruby/lib/ruby/1.8/monitor.rb:229:in
> `synchronize'
>         from c:/ruby/lib/ruby/1.8/net/ftp.rb:174:in
> `connect'
>         from c:/ruby/lib/ruby/1.8/net/ftp.rb:136:in
> `initialize'
>         from (irb):5
>
> irb(main):006:0> ftp.passive = true
> NoMethodError: undefined method `passive=' for nil:NilClass
>         from (irb):6
> ----
>
> While browsing through the Ruby Docs (
> http://www.ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/classes/Net/FTP.html
> ) I see that "passive" is an Attribute that I can set, but I don't know how
> to do that.  I also found this chapter from Matz' Nutshell book and it
> refers to the attribute too (
> http://www.oreilly.com/catalog/ruby/chapter/ch04.html ).
>
> Can anyone suggest how I might get this to work at the IRB prompt?  Thanks.
>
> Paul.
>
>
>
> _______________________________________________
> Wtr-general mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/wtr-general
>
>
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to