Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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 = '127.0.0.1'; 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1037358]
help
Chatterbox?
[Lady_Aleena]: shmem, geany on Debian jessie.
[shmem]: some experience with vim?
[Lady_Aleena]: None
[shmem]: I don't know geany, and don't know whether it has support for ctags.
[Lady_Aleena]: ctags?
[shmem]: ctags is a program which (recursively) extracts the symbols from source and stores them in a one-file database. This allows you to query the locations where these symbols (e.g. a subroutine name) are used anywhere in the source code tree...
[shmem]: ...from inside the editor.
[shmem]: apt-get install exuberant-ctags
[Lady_Aleena]: I think I heard vim has a big learning curve.
[shmem]: then in the root of your source tree run: ctags -R

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-04-27 12:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (505 votes). Check out past polls.