You changed directories into ‘data’, and are then trying to list a
‘data’ dir?
FWIW, all the above worked fine with me using Ruby 1.8.5 on Windows,
going to a known-working and accessible FTP server. Smells like either a
firewall/port-blocking issue, or a double-NAT issue. To be sure: can you
FTP from the command line/shell just fine?
files = ftp.dir(dir = nil)
FTP from the command line/shell just fine?
I see what your saying about the ‘data’ directory and I re-did it
without changing to the ‘data’ directory and get the same error. See
sample code below;
irb(main):006:0> ftp.login(‘bruskeftp’,‘35sumler75’,nil)
=> “230 User bruskeftp logged in.\n”
irb(main):007:0> files = ftp.dir(‘data’)
Net::FTPPermError: 500 Invalid PORT Command.
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:243:in
getresp' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:251:invoidresp’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:274:in voidcmd' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/monitor.rb:229:insynchronize’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:272:in voidcmd' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:290:insendport’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:298:in makeport' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:329:intransfercmd’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:421:in retrlines' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/monitor.rb:229:insynchronize’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:419:in retrlines' from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:628:indir’
from (irb):7
from :0
I hate to bring up the “P” word but I did the same thing using python
and had no problem. Sample code below;
ftp.login(‘bruskeftp’,‘35sumler75’)
‘230 User bruskeftp logged in.’