timeout problem in IO::Socket.pm

Andrew Daviel (advax@triumf.ca)
Thu, 28 Dec 2000 16:47:11 -0800 (PST)


I have been having some trouble with some web robot code
under RedHat 6.2 using libwww-perl-5.48 and
perl-5.00503-12.

I found that if the destination address does not respond
that the connect in IO::Socket.pm is not timing out
properly.

e.g.
  use IO::Socket ;
  $sock = IO::Socket::INET->new(PeerAddr => '216.13.169.245',
                       PeerPort => 'http(80)',
                       Proto     => 'tcp',
                       Timeout => 5) ;


I changed "undef" to "close" on line 203 and it seems to fix the
problem. I confess I don't really know what I'm doing ...

viz.       local($SIG{ALRM}) = $timeout ? sub { close $fh; }



Andrew Daviel, TRIUMF, Canada
Tel. +1 (604) 222-7376
security@triumf.ca