network programming - How do I set the socket timeout in Ruby? -


how set timeout blocking operations on ruby socket?

the solution found appears work use timeout::timeout:

require 'timeout'     ... begin      timeout(5)         message, client_address = some_socket.recvfrom(1024)     end rescue timeout::error     puts "timed out!" end 

Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -