Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Testing for port connectivity

by JSchmitz (Canon)
on Sep 04, 2006 at 12:20 UTC ( #571070=note: print w/ replies, xml ) Need Help??


in reply to Testing for port connectivity

I think you mean open (IN, "<hostnames.txt" ) || die "Can't open hostnames.txt";

Try something more like this?

#!/usr/bin/perl -w use strict; use IO::Socket::PortState qw(check_ports); my $proto = 'tcp'; my $port = '23'; my $service = 'telnet port'; my $address = '70.114.230.116'; my $porthash{$proto}->{$port}->{'name'} = $section; check_ports( $address, $ping_timeout, \%porthash ); my $open = $porthash{$proto}->{$port}->{'open'}; if ($open) { print "alive\n"; } else { print "dead\n"; }

Cheers -

Jeffery


Comment on Re: Testing for port connectivity
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://571070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2015-07-30 18:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls