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
Post a Comment