# Ip ftp

**URL:** <https://www.ruby-forum.com/t/ip-ftp/172453>\
**Category:** Ruby\
**Created:** [July 21, 2009, 8:39pm UTC](https://www.ruby-forum.com/t/ip-ftp/172453 "2009-07-21T20:39:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ilivni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/e19b73/32.png) [@ilivni](https://www.ruby-forum.com/u/ilivni)\
**Post date:** [July 21, 2009, 8:39pm UTC](https://www.ruby-forum.com/t/ip-ftp/172453/1 "2009-07-21T20:39:13Z")

</div>

The idea of this script is:

1. Download ftp file.
2. Mail to some user (have not done that yet (yes this is essentially  
my first script)

I am trying to incorporate some error handling so the script needs

1. To test if machine has Internet connection
2. check if ip is connectected.

This is where i fail to understand why this does not work. The script  
essentially just times out

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/ftp.rb:159:in  
`initialize’: Operation timed out - connect(2) (Errno::ETIMEDOUT)

in the terminal i get under 1 sec response times.

Thank you in advance

if Ping.pingecho(ipMainAddress, 2) == true then  
ipAddress = ipMainAddress  
elsif Ping.pingecho(ipBackUpAddress, 2) == true then  
ipAddress = ipBackUpAddress  
else  
puts "Check the following 3 things: "  
end

# ftp = Net::FTP.new(ipAddress)

# 

# ftp.login(userId, passWord)

# ftp.getbinaryfile(fileName)

# ftp.close
