<p>How do you set the timeout for blocking operations on a Ruby socket?</p>

The solution I found which appears to work is to use
Timeout::timeout
:
```
```
require 'timeout'
    ...
begin 
    timeout(5) do
        message, client_address = some_socket.recvfrom(1024)
    end
rescue Timeout::Error
    puts "Timed out!"
end
```
```