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-1.8.6.111-1.fc8 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?

Thanks,

#!/usr/bin/ruby

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.chdir(’/data/observations/metar/stations’)
ftp.gettextfile("#{id.upcase}.TXT") do |line|
metar[i] = line
i = i + 1
end
ftp.close
return metar
end

puts getMetar(“KBFL”)

[[email protected] ~]$ 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:intransfercmd’
from /usr/lib/ruby/1.8/net/ftp.rb:421:in retrlines' from /usr/lib/ruby/1.8/monitor.rb:242:insynchronize’
from /usr/lib/ruby/1.8/net/ftp.rb:419:in retrlines' from /usr/lib/ruby/1.8/net/ftp.rb:518:ingettextfile’
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/