in reply to Socket timeouts without ALARM

Set nonblocking mode and use select or just use IO::Socket, where the work is already done for you. Internally it's using nonblocking mode. The Timeout value is used for other operations, so you may want to reset it once the connection is up.
my $socket=IO::Socket::INET->new(PeerAddr => '127.0.0.1', PeerPort => 80, Proto => 'tcp', Timeout => 5);

Replies are listed 'Best First'.
(tye)Re: Socket timeouts without ALARM
by tye (Sage) on Nov 09, 2001 at 10:06 UTC

    IO::Socket's timeouts mostly require alarm and so are just silently ignored under Win32.

            - tye (but my friends call me "Tye")
      Perhaps this was true at some point, but at least for ActiveState's perl, IO::Socket uses non-blocking mode in conjuction with IO::Select to implement the timeouts.

      Update: Well, this is true, the code is there, it uses non-blocking mode instead of alarm(), but it appears to be broken in Win32. <sigh>