Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Ping from Perl?

Posted by enquirer (enquirer), 1 May 2004
How can I test whether a computer is visible on the network in a Perl program?

Posted by admin (Graham Ellis), 1 May 2004
The Net:ing module is probably the best way to do this - available from the CPAN if you don't already have it loaded.

Here's a module I use to test for web servers running on port 80 ... you can also test for icmp (or udp) rather than tcp visibility - icmp is the "normal" ping but has to be run with admin privelidge.

use Net::Ping;

package seehost;

# Wrapper around Ping. Wrapper can be amended as need be to tune ping params

sub testhost {
       $p = new Net::Ping("tcp");
       @result = $p -> ping($_[0],2);


Built into a program on our inhouse network, this allows us to check all our systems in a few seconds - it does involve a bit of forking (perhaps I should post this as a separate thread?) but we get results like:

Testing the network (port 80) ...
... ... ... (wind) responded
... ... ... (penguin) responded
... (thursday) responded (friday) responded (mars) responded
... ( responded
... (biriani) responded (macdougall) responded (pasanda) responded (tea) responded
... (saturn) responded
... (panther) responded
... ...
Testing completed Trainer's console connected via wireless
Projection laptop connected via wireless
Cable and backup ISDN internet connections both present

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2023: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho