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

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

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -