Re: newbie ftp problem

From: [email protected] [mailto:[email protected]]

files = ftp.nlst(‘data’)

Net::FTPPermError: 500 Invalid PORT command.

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?

On Thu, 19 Oct 2006, Gavin K. wrote:

From: [email protected] [mailto:[email protected]]

ftp = Net::FTP::new(‘my.url.com’)
ftp.login(‘login_id’,‘login_pass’,nil)
ftp.chdir(‘data’)

all goes fine but at this point I have tried all of the following and
get the same errors

try

ftp.passive = true

files = ftp.list(‘data’)
files = ftp.dir(‘data’)
files = ftp.dir(dir = nil)
files = ftp.nlst(‘data’)

Net::FTPPermError: 500 Invalid PORT command.

-a

Gavin K. wrote:

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.’

ftp.dir(‘data’)
10-17-06 01:08PM 19377920 cust.TPS
10-17-06 06:29AM 30131456 detail.tps
10-12-06 12:32AM 771584 Item.tps
10-18-06 02:18AM 3072 mgr.tps
10-17-06 06:29AM 617728 open.tps
10-17-06 08:40AM 237056 OpnInv.TPS
10-18-06 01:34AM 95488 OrdHdr.tps
10-17-06 08:24AM 135424 OrdLin.tps
10-15-06 12:56AM 4864 PCOrdHdr.TPS
10-15-06 12:56AM 4352 PCOrdLin.TPS
10-12-06 12:30AM 303616 Price.tps
10-18-06 02:18AM 25088 slsmn.tps

Unfortunetly, I am really new to Ruby, and really wanted to start using
it for some production stuff.

I want to thank you for your time and help if you happen to think of
anything else I will give it a shot.

Len S.

Looks like a passive ftp mode problem versus standard ftp using port 20,
and 21. See if at the api you can turn passive mode on.

Hope that helps.

[email protected] wrote:

try

-a

my religion is very simple. my religion is kindness. – the dalai lama

Tried the passive - still get the same error

Thanks
Len S.

John P. wrote:

ftp.chdir(‘data’)
You changed directories into ‘data’, and are then trying to list a

`voidcmd’
from c:/ruby/freeride/freeruby-win/lib/ruby/1.8/net/ftp.rb:421:in

10-17-06 06:29AM 617728 open.tps

I want to thank you for your time and help if you happen to think of
anything else I will give it a shot.

Len S.

I’m sorry I retried the setting of passive and that DID fix the
problem.

I want to thank you all for your time and your help and I hope someday
to be able to help others out on this ng.

Thanks
Len S.