one short example.


begin

  # connect, login, ...

rescue Errno::ECONNREFUSED   # Connection refused
  sleep some_time and retry
  # and (or) more suitable processing
rescue Errno::ECONNRESET     # Connection reset by peer
  sleep some_time and retry
  # and (or) more suitable processing
rescue TimeoutError          # timed-out
  sleep some_time and retry
  # and (or) more suitable processing
rescue
  # ...
end


begin

  # main routine

rescue Errno::ECONNRESET     # Connection reset by peer
  # ...
rescue TimeoutError          # timed-out
  # ...
rescue
  # ...
end


begin

  # logout, ...

rescue Errno::ECONNRESET     # Connection reset by peer
  # ...
rescue TimeoutError          # timed-out
  # ...
rescue
  # ...
end


-- 
Wakou Aoyama  <wakou / fsinet.or.jp>