dru145 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks,#!/usr/bin/perl -w use strict; use IO::Socket::INET; my @host = ('192.168.1.3', '192.168.46.2'); my $port = '22'; my ($connected); foreach (@host){ check($_); } sub check { my $ip = $_[0]; my $sock = IO::Socket::INET->new(PeerAddr => $ip, PeerPort => $port, Proto => 'tcp', timeout => '10') and $connected = 1; print "$ip is listening on port $port\n" if $connected; print "$ip is NOT listening on port $port.\n" unless $connected; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array Woes
by thelenm (Vicar) on Dec 12, 2002 at 17:55 UTC | |
|
Re: Array Woes
by Abigail-II (Bishop) on Dec 12, 2002 at 17:59 UTC | |
|
Re: Using 'and'
by tadman (Prior) on Dec 12, 2002 at 19:32 UTC | |
by LAI (Hermit) on Dec 12, 2002 at 22:13 UTC | |
by tadman (Prior) on Dec 12, 2002 at 22:20 UTC | |
by agentv (Friar) on Dec 12, 2002 at 23:50 UTC | |
by LAI (Hermit) on Dec 13, 2002 at 14:50 UTC | |
by tadman (Prior) on Dec 13, 2002 at 18:00 UTC | |
by agentv (Friar) on Dec 12, 2002 at 23:48 UTC | |
|
Re: Array Woes
by pg (Canon) on Dec 12, 2002 at 18:09 UTC |