[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: newbie ftp problem

Gavin Kistner

10/18/2006 6:20:00 PM

From: lsumnler@gmail.com [mailto:lsumnler@gmail.com]
> 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
>
> files = ftp.list('data')
> files = ftp.dir('data')
> files = ftp.dir(dir = nil)
> 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?

5 Answers

Ara.T.Howard

10/18/2006 6:47:00 PM

0

len

10/18/2006 6:49:00 PM

0


Gavin Kistner wrote:
> From: lsumnler@gmail.com [mailto:lsumnler@gmail.com]
> > 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
> >
> > files = ftp.list('data')
> > files = ftp.dir('data')
> > files = ftp.dir(dir = nil)
> > 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?

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:in
`voidresp'
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:in
`synchronize'
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:in
`sendport'
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:in
`transfercmd'
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:in
`synchronize'
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:in
`dir'
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 Sumnler

John Pywtorak

10/18/2006 7:08:00 PM

0

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.

lsumnler@gmail.com wrote:
> Gavin Kistner wrote:
>> From: lsumnler@gmail.com [mailto:lsumnler@gmail.com]
>>> 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
>>>
>>> files = ftp.list('data')
>>> files = ftp.dir('data')
>>> files = ftp.dir(dir = nil)
>>> 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?
>
> 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:in
> `voidresp'
> 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:in
> `synchronize'
> 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:in
> `sendport'
> 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:in
> `transfercmd'
> 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:in
> `synchronize'
> 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:in
> `dir'
> 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 Sumnler
>
>
>


len

10/18/2006 7:10:00 PM

0


ara.t.howard@noaa.gov wrote:
> On Thu, 19 Oct 2006, Gavin Kistner wrote:
>
> > From: lsumnler@gmail.com [mailto:lsumnler@gmail.com]
> >> 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
> --
> my religion is very simple. my religion is kindness. -- the dalai lama

Tried the passive - still get the same error

Thanks
Len Sumnler

len

10/18/2006 7:15:00 PM

0


John Pywtorak wrote:
> 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.
>
> lsumnler@gmail.com wrote:
> > Gavin Kistner wrote:
> >> From: lsumnler@gmail.com [mailto:lsumnler@gmail.com]
> >>> 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
> >>>
> >>> files = ftp.list('data')
> >>> files = ftp.dir('data')
> >>> files = ftp.dir(dir = nil)
> >>> 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?
> >
> > 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:in
> > `voidresp'
> > 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:in
> > `synchronize'
> > 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:in
> > `sendport'
> > 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:in
> > `transfercmd'
> > 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:in
> > `synchronize'
> > 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:in
> > `dir'
> > 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 Sumnler
> >
> >
> >

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 Sumnler