This is my Blog.

It's full of opinions on a wide range of stuff.

Checking Network Connectivity with Ruby

I've just been playing around with a few things and stumbled accross a really neat ruby lib called ‘timeout'. I used it to make a quick check for network connectivity like so:

require 'timeout'
require 'socket'

  timeout(10) do"", 80)
    puts true
  puts false

For so few lines thats a really neat; I thought so at least! :-)

blog comments powered by Disqus