From: Timothy Hunter Date: 2007-02-27T09:20:05+09:00 Subject: Net::FTP hangs Running ruby 1.8.5 (2006-08-25) on Mac OS X 10.4.8. I'm trying to get this example from the _Ruby_Cookbook_ to work, but it hangs in the ftp.list method. What am I doing wrong? #!/usr/bin/env ruby require 'net/ftp' ftp = Net::FTP.open("ftp.ibiblio.org") do |ftp| ftp.login ftp.chdir("pub/linux/") ftp.list('*Linux*') {|file| puts file} end Eventually this will fail with these messages: /opt/local/lib/ruby/1.8/net/ftp.rb:241:in `getresp': 425 Unable to build data connection: Connection timed out (Net::FTPTempError) from /opt/local/lib/ruby/1.8/net/ftp.rb:264:in `sendcmd' from /opt/local/lib/ruby/1.8/monitor.rb:238:in `synchronize' from /opt/local/lib/ruby/1.8/net/ftp.rb:262:in `sendcmd' from /opt/local/lib/ruby/1.8/net/ftp.rb:336:in `transfercmd' from /opt/local/lib/ruby/1.8/net/ftp.rb:421:in `retrlines' from /opt/local/lib/ruby/1.8/monitor.rb:238:in `synchronize' from /opt/local/lib/ruby/1.8/net/ftp.rb:419:in `retrlines' from /opt/local/lib/ruby/1.8/net/ftp.rb:625:in `list' from ftptest.rb:8 from /opt/local/lib/ruby/1.8/net/ftp.rb:115:in `open' from ftptest.rb:5 I can connect to this server and issue similar commands using the command line ftp client: ruby$ ftp ftp> open ftp.ibiblio.org Connected to ibiblio.org. 220 ProFTPD Server (Bring it on...) Name (ftp.ibiblio.org:tim): anonymous 331 Anonymous login ok, send your complete email address as your password. Password: 230- Welcome to ftp.ibiblio.org, the public ftp server of ibiblio.org. We hope you find what you're looking for. If you have any problems or questions, please send email to ftpkeeper@ibiblio.org Thanks! 230 Anonymous access granted, restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd pub/linux 250 CWD command successful ftp> ls *Linux* 229 Entering Extended Passive Mode (|||60724|) 150 Opening ASCII mode data connection for file list -rw-r--r-- 1 (?) users 531113 Feb 26 11:06 00-find.Linux.gz -rw-rw-r-- 1 (?) admin 73 Mar 9 2001 How-do-I-get-Linux 226 Transfer complete. ftp>