[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ping via perl?



On Mon, May 01, 2000 at 04:20:52PM -0500, w trillich wrote:
> could this be a result of the perl5.004* vs. 5.005* situation?
> if not, then--what?
> 
> 
> #!/usr/bin/perl
> 
> use Net::Ping;
> 
> my $ip = "208.33.90.84";
> my $wait = 5;
> 
> $p = Net::Ping->new();
> print "$ip is alive.\n" if $p->ping($ip);
> $p->close();
> 
> __END__
> 
> 
> Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be
> 16 at /usr/lib/perl5/5.005/i386-linux/Socket.pm line 295, <IN> chunk 3.
>         Socket::sockaddr_in(undef) called at
> /usr/lib/perl5/5.005/Net/Ping.pm line 374
>         Net::Ping::ping_udp('Net::Ping=HASH(0x829e990)', 'M-P!X^E', 5)
> called at /usr/lib/perl5/5.005/Net/Ping.pm line 154
>         Net::Ping::ping('Net::Ping=HASH(0x829e990)', 'speedex.net')
> called at ping.pl line 9
> Debugged program terminated.  Use q to quit or R to restart,

I ran into this problem a few weeks ago; At the time I think I decided
it was a problem with the Socket module.  I hadn't investigated it
much since I found a solution that worked for me.

The Net::Ping module is part of package perl-5.005; there's an open
bug that seems to address this issue:

  http://www.debian.org/Bugs/db/55/55427.html

Note that this Net::Ping module tries to create a UDP socket by
default;  this doesn't work.  I don't think the TCP socket ping worked
for me either.

The good news is that the ICMP type works fine; however it must run
under root priviledges.

HTH,

-- 
Nathan Norman         "Eschew Obfuscation"          Network Engineer
GPG Key ID 1024D/51F98BB7            http://home.midco.net/~nnorman/
Key fingerprint = C5F4 A147 416C E0BF AB73  8BEF F0C8 255C 51F9 8BB7

Attachment: pgpA9ItW6V35C.pgp
Description: PGP signature


Reply to: