Receive timeout on socket

Hello,

How do I set a receive timeout on a UDPSocket? I’d like to timeout after
5
seconds. I tried this

sock.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, SockTimeout)

but I got an error.

./bin/…/lib/net/tftp+.rb:508:in setsockopt': Invalid argument (Errno::EINVAL) from ./bin/../lib/net/tftp+.rb:508:indownload’
from ./bin/tftp_client.rb:81:in `main’
from ./bin/tftp_client.rb:98

Mike