in reply to Re: what does timeout mean in IO::Socket::INET ?
in thread what does timeout mean in IO::Socket::INET ?
2. socket options SO_RCVTIMEO and SO_SNDTIMEO seem to offer exactly what's required. Unfortunately the POSIX (1003.1, 2004) specification says "not all implementations allow this option to be set", which isn't encouraging -- life is complicated enough, already. When I tried it, Linux (2.6.27.7-53) rejected the attempt to $sock->sockopt(SO_RCVTIMEO, 10) :-(Linux supports these options, but you should pass packed struct timeval as argument. This is not very portable way unfortunately. On my 64bit system (it's 2.6.27 too btw) it looks like this:
On 32bit system you probably should use "ll" instead of "qq".my $timeo = pack("qq", 10, 0); $sock->sockopt(SO_RCVTIMEO, $timeo);
|
|---|