Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Inconsistant Net::Ping on XP

by traveler (Parson)
on Nov 23, 2007 at 20:24 UTC ( [id://652656]=perlquestion: print w/replies, xml ) Need Help??

traveler has asked for the wisdom of the Perl Monks concerning the following question:

I am using something like this to ping other hosts:
use strict; use Net::Ping; use Time::HiRes; my $p = Net::Ping->new("icmp"); $p->hires(); while (1) { my ($ret, $duration, $ip) = $p->ping($host, 5); printf "02d:%02d:%02d,%d,%.0f\n", $hour,$min,$sec,$ret,$duration*1000; sleep 3; }
This seems pretty close to the icmp example in the docs.

I get results of generally 16 ms or 0 ms. I never get a non-0 number less than 16 (and I get larger numbers in rough multiples of 16. So this looks like a Win32 issue of time granularity.

Is there something I can do?

Thanks, --traveler

Update: From reading lots of four-year-old posts here it seems that I have an old hires.dll, even though I have perl 5.8.1. Where do I get a new dll?

Replies are listed 'Best First'.
Re: Inconsistant Net::Ping on XP
by BrowserUk (Patriarch) on Nov 23, 2007 at 23:06 UTC
      I stuck in the new version with ppm. Perl clearly finds it, but can't use it. I get the error
      Time::HiRes object version 1.52 does not match $Time::HiRes::XS_VERSIO +N 1.87 at C:/Perl/lib/DynaLoader.pm line 249. Compilation failed in require at C:\John\tools\netcsvdata.pl line 4. BEGIN failed--compilation aborted at C:\John\tools\netcsvdata.pl line +4.
      So this seems to mean that the 1.87 pm file is trying to use some object version of the old 1.52. I've not had this error before? What do I do? Thanks.
        Looks like a bungled installation. You've got version 1.87 of HiRes.pm, but version 1.52 of HiRes.dll.

        PPM doesn't usually produce this sort of problem ... try doing the 'ppm install Time-HiRes' again. (You might need to ppm remove Time-Hires first.)

        Cheers,
        Rob
        I stuck in the new version with ppm.

        PPM doesn't (usually) make that kind of mistake, so perhaps you would explain what you actually did?

        Where did you find the 1.87 ppd? What command(s) did you use to install it?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
      I have 1.52. ppm found a newer one and I will try upgrading that. In an old post you mentioned updating the dll. I will see if the new Time::HiRes fixes things. Thanks.

        I see cpan has 1.97, but (again from memory) version 1.68? comes to mind. If you can't find a version newer than that as a ppm and you don't have the option to build the cpan version, /msg me and I'll send you a zip file.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://652656]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-04-18 07:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found