FTP problem under Linux?

The code below, as ugly as it is, runs perfectly on Windows but hangs at
the gettextfile under Linux. I’m using ruby- on Fedora 8
and ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] under Windows
XP. I am able to use the command line ftp client to log into the site
and retrieve the file with no problems. Any ideas?



require ‘net/ftp’

def getMetar(id)
metar = Array.new
i = 0
ftp = Net::FTP.new(‘tgftp.nws.noaa.gov’)
puts ftp.login
puts ftp.sendcmd(‘PASV’)
ftp.gettextfile(“#{id.upcase}.TXT”) do |line|
metar[i] = line
i = i + 1
return metar

puts getMetar(“KBFL”)

[knute@www ~]$ ruby metar.rb
230 Login successful.
227 Entering Passive Mode (140,90,128,71,154,251)
/usr/lib/ruby/1.8/net/ftp.rb:340:in accept': Interrupt from /usr/lib/ruby/1.8/net/ftp.rb:340:in transfercmd’
from /usr/lib/ruby/1.8/net/ftp.rb:421:in retrlines' from /usr/lib/ruby/1.8/monitor.rb:242:in synchronize’
from /usr/lib/ruby/1.8/net/ftp.rb:419:in retrlines' from /usr/lib/ruby/1.8/net/ftp.rb:518:in gettextfile’
from metar.rb:13:in `getMetar’
from metar.rb:37

The error trace is generated when I press control-C after the hang.

Knute Johnson
email s/nospam/knute/