Hi All,

I have the following problem.

_Code:_
#!/usr/bin/perl
use IO::Socket;

my $host=shift @ARGV or die 'need hostname';
my $port=shift @ARGV or die 'need port number';
my $timeout=1;
my $socket=IO::Socket::INET->new(PeerAddr=> $host,
       PeerPort => $port,
       Proto => 'tcp',
       Type => SOCK_STREAM
       Timeout => defined($timeout)?$timeout:10) or die "Can't talk to
$host at $port";

When I test this on a machine that is currently switched off it takes about a minute to timeout. I the code above I specify $timeout to be 1. Surely it sould timeout after 1 sec.

What is wrong with this?

Regards
Otto

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to