Werner Otto wrote:
> 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

There's a comma missing here.

>         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 platform and what version of Perl and IO::Socket? If I fix the missing
comma, it times out properly for me with Perl 5.6.1 on FreeBSD 4.10

-- 
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