Humm....

   I got this from the Net:Ping mod..... Hope it may help.


    use Net::Ping;

    $p = Net::Ping->new();
    print "$host is alive.\n" if $p->ping($host);
    $p->close();

    $p = Net::Ping->new("icmp");
    foreach $host (@host_array)
    {
        print "$host is ";
        print "NOT " unless $p->ping($host, 2);
        print "reachable.\n";
        sleep(1);
    }
    $p->close();

BTW, I sort of "carp'ed" out on the root access....

Cheers,

/LG


                                                                                       
                            
                                                                                       
                            
                                                                 Para:   "Carter A. 
Thompson"                      
               Carl Jolley <[EMAIL PROTECTED]>                     <[EMAIL PROTECTED]> 
                            
               Enviado Por:                                      cc:     Tim Rhodes 
<[EMAIL PROTECTED]>,                
               [EMAIL PROTECTED]        
<[EMAIL PROTECTED]>       
               e.com                                             Assunto:     Re: perl 
ping?                       
                                                                                       
                            
                                                                                       
                            
               20/03/02 15:05 EST                                                      
                            
                                                                                       
                            
                                                                                       
                            



On Tue, 19 Mar 2002, Carter A. Thompson wrote:

>
> ----- Original Message -----
> From: "Tim Rhodes" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, March 19, 2002 2:49 PM
> Subject: perl ping?
>
>
> > it won't let me use that. my script needs root access. any other
> solutions?
>
> I suppose you could always use system("ping $host") and decode the
> return code.
>
> system("ping $host");
> $status = $? >> 8;
> if ($status != 0) {
>     #failed to connect.
> }
>
> Anyone else?
>

That won't work if ping need root.

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs




_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to