Try opening your ftp connection in passive mode; http://ruby-doc.org/stdlib/libdoc/net/ftp/rdoc/index.html Sam On 19/09/11 10:45, Reese Chappuis wrote: > I've been writing a super simple terminal FTP client to send text files > from. > > The code is: > require 'net/ftp' > > puts 'Enter the full path of the text file: ' > filename=gets.chomp > puts 'Enter the hostname of the remote computer: ' > hostname=gets.chomp > puts 'Enter the username for the remote computer: ' > uname = gets.chomp > puts 'Enter the password associated with the username: ' > pass = gets.chomp > puts 'Enter the path of the remote file: ' > rfilename = gets.chomp > > def sendfile filename, rfilename=filename, hostname, uname, pass > ftp = Net::FTP.new(hostname) > puts "\nConnecting to "+hostname+"..." > ftp.login uname, pass > ftp.puttextfile filename, rfilename > ftp.close > end > > sendfile filename, rfilename, hostname, uname, pass > > Now, I've been getting this error: /usr/lib/ruby/1.9.1/net/ftp.rb:271:in > `getresp': 425 Could not open data connection to port 22533: Connection > timed out (Net::FTPTempError) > > But I don't know why it is trying to go to that port- isn't FTP port 21? Is > there a way to change this? >