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

#!/usr/bin/perl use 5.010; use Net::Ping; $addr = <stdin>; chomp $addr; $p = Net::Ping->new("icmp"); if( $p->ping($addr)){ print "$addr is alive"; } else { print "$addr appear to be down"; } $p->close();

icmp socket error an attempt was made to access a socket in a way forbidden by its access permission

am using win7

Replies are listed 'Best First'.
Re: icmp socket error
by hippo (Archbishop) on Feb 08, 2015 at 17:49 UTC

    From the Net::Ping documentation:

    Specifying the "icmp" protocol requires that the program be run as root or that the program be setuid to root.

    Therefore the supposition is that you are not doing that (or its equivalent under MSWindows, whatever that might be).

      Correct. You'll need to run the program as "Administrator", Windows equivalent of *nix "root".

      I use this on Windows 7 x64 / Strawberry 5.18.1 x64