From: Brian Candler Date: 2008-11-14T17:04:58+09:00 Subject: Re: How to set socket option SO_RCVTIMEO Kem Mason wrote: > hehe yeh I just realized I could use a regular Socket instead of a TCP > Socket -- it doesn't appear to be the only problem though. here's my > latest code (which still doesn't timeout properly) Well, probably you shouldn't be using setsockopt for this at all. Note that setting SO_RCVTIMEO just raises an EAGAIN on timeout; I'd expect that gets would trap that and retry. Why not simply: require 'timeout' result = nil timeout(1.5) { result = sock.gets } -- Posted via http://www.ruby-forum.com/.