develooper Front page | perl.libwww | Postings from December 2000

timeout problem in IO::Socket.pm

Thread Next
From:
Andrew Daviel
Date:
December 28, 2000 16:47
Subject:
timeout problem in IO::Socket.pm
Message ID:
Pine.LNX.4.21.0012281635220.15886-100000@andrew.triumf.ca

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


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About