Tcp socket rescue error? how to handle

I know this is kind of a basic error handle, i wrote this client a long
time ago and it works well but im tiered of seeing
Connection refused - connect(2) (Errno::ECONNREFUSED)

i would would like to see the client just exit

I handle the socket with a block{}

TCPSocket.open(ARGV[0],ARGV[1]) {|sock| do something with socket}

so, i guess what im trying to do is something like this

TCPSocket.open(ARGV[0],ARGV[1]) { rescue; puts"exit now"; else |sock|

here is a pastebin, line 15

http://pastebin.com/xGrAZ6UG

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs