| | |
Perl Ping Help
![]() |
•
•
Join Date: Aug 2005
Posts: 1
Reputation:
Solved Threads: 0
hi,
i have been asked to get the information of the systems in the network by executing ping in perl programming.
use Net:
ing;
$p = Net:
ing->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
sample of my code is shown above
where $host--> is the ip of the destination machine. if i try to give the loopback or ip of my machine then its working properly. but if i try to give ip of the some other machine conneted to network then ping will not work.
But ping using command prompt is working properly for any machine in the network.
Is there anybody to help me out...
i have been asked to get the information of the systems in the network by executing ping in perl programming.
use Net:
ing;$p = Net:
ing->new();print "$host is alive.\n" if $p->ping($host);
$p->close();
sample of my code is shown above
where $host--> is the ip of the destination machine. if i try to give the loopback or ip of my machine then its working properly. but if i try to give ip of the some other machine conneted to network then ping will not work.
But ping using command prompt is working properly for any machine in the network.
Is there anybody to help me out...
•
•
Join Date: Jun 2005
Posts: 16
Reputation:
Solved Threads: 0
Net:
ing defaults to a tcp connection to the echo port (7 according to my /etc/services file). Use this (from the Net:
ing man page) example to do a regular ICMP ping like the command line:
Kordaff
ing defaults to a tcp connection to the echo port (7 according to my /etc/services file). Use this (from the Net:
ing man page) example to do a regular ICMP ping like the command line: Perl Syntax (Toggle Plain Text)
use Net::Ping; my $p = Net::Ping->new('icmp'); print "$host is "; print "NOT " unless $p->ping($host, 2); print "reachable.\n"; sleep(1); $p->close();
Kordaff
![]() |
Similar Threads
- DOS Batch command to ping network IP (Legacy and Other Languages)
- perl inline module (Perl)
- Your thoughts regarding Perl (Perl)
- OptiPerl - Perl IDE (Perl)
Other Threads in the Perl Forum
- Previous Thread: Rather strange problem copying, need assistance.
- Next Thread: Perl MIME handler -> how to get the invoking filehandle?
| Thread Tools | Search this Thread |





