Subject: | ping returns true regardless of port_num |
I have compiled perl 5.8.3 under RedHat advanced server 3.0 and RedHat Advanced server 2.1. Using the Net::Ping module to test the availibily of services outside of ICMP seems not to work. If I choose the tcp protocol and a port such as httpd or ssh the ping always returns 1 not matter what state the service is in. This is not a problem under perl 5.6.1
This snippet of code returns true even though there is no web server installed on the target host
#!/usr/local/bin/perl -w
use strict;
use Net::Ping;
my $p = Net::Ping->new("tcp", 3);
$p->{port_num} = 80;
return $p->ping("srv1.p.inf7");
Here is the output of perl -V
mselby@util1a.h.ops1 /longitude/SOFT/perl5/5.8.3/lib/5.8.3/Net 4279$ /longitude/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 3) configuration:
Platform:
osname=linux, osvers=2.4.21-9.elsmp, archname=i386-linux
uname='linux bld2a.p.ops1.longitude.com 2.4.21-9.elsmp #1 smp thu jan 8 17:08:56 est 2004 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dmksymlinks -Dcc=gcc -Dcccdlflags=-fPIC -Dprefix=/longitude/SOFT/perl5/5.8.3 -Dinstallprefix=/longitude/SOFT/perl5/5.8.3 -Dotherlibdirs=/longitude/lib/perl5 -Darchname=i386-linux -Dman3ext=3pm -Dmyhostname=localhost -Dperladmin=root@localhost -Uusethreads -Uuseithreads'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -g -pipe -march=i386 -mcpu=i686',
cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.3 20030502 (Red Hat Linux 3.2.3-24)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING USE_LARGE_FILES
Built under linux
Compiled at Jun 3 2004 17:08:44
@INC:
/longitude/SOFT/perl5/5.8.3/lib/5.8.3/i386-linux
/longitude/SOFT/perl5/5.8.3/lib/5.8.3
/longitude/SOFT/perl5/5.8.3/lib/site_perl/5.8.3/i386-linux
/longitude/SOFT/perl5/5.8.3/lib/site_perl/5.8.3
/longitude/SOFT/perl5/5.8.3/lib/site_perl
/longitude/lib/perl5
.