Ip ftp

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

`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
puts "Check the following 3 things: "

ftp = Net::FTP.new(ipAddress)

ftp.login(userId, passWord)