redss has asked for the wisdom of the Perl Monks concerning the following question:

I need to wrap sysread function in an alarm timeout, but I can't find any options that are reliable under windows XP.

I understand IO:select isn't suitable for windows, and I can't get the following code to work either. Ideas?

eval { $timeout = 1; local $SIG{ALRM} = sub { die "alarm\n" }; alarm $timeout; $ret = sysread($sock, $buf, 100); alarm 0; };

Replies are listed 'Best First'.
Re: How to make sysread timeout on windows?
by ikegami (Patriarch) on Nov 10, 2007 at 02:41 UTC
    IO::Select works fine on sockets (and only on sockets) in Windows, which seems to be what you want to do.