Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Usage of IO::Socket::PortState

by Khen1950fx (Canon)
on Jun 06, 2013 at 04:04 UTC ( #1037358=note: print w/replies, xml ) Need Help??

in reply to Usage of IO::Socket::PortState

See: Testing for port connectivity. JSchmitz shows you how to get the status of a single port, and McDarren shows how to handle multiple hosts. Here's an example:
#!/usr/bin/perl use strict; use warnings; use IO::Socket::PortState qw(check_ports); my $proto = 'tcp'; my $port = '80'; my $address = ''; my($section, $ping_timeout, %porthash); $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"; }

Replies are listed 'Best First'.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1037358]
[GotToBTru]: time for some C8H10N4O2 for me
[ambrus]: GotToBTru: wait, you tell only the atom totals of what you want? Is that like ordering food in a restaurant by telling only the nutrient amounts you need, or
[ambrus]: like when a medieval scientist supposedly proves his priority inventing something by having previously published an anagram of a thousand letters long summary of the invention?
[choroba]: Progress! Nowadays, you can write a Perl script to generate such an anagram!
[GotToBTru]: i like to order my chemicals a-la-carte ambrus ;)

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2016-12-06 13:04 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (104 votes). Check out past polls.