The alarm 'function'
actually sends an alarm signal to the current process, which you can handle with
the anonymous subroutine below:
$SIG{ALRM} = sub { print "Caught alarm
signal"; };
The problem is most of Perl's IPC functionality is
based on native Unix IPC mechanisms, which is why on Windows machines you often
find IPC calls like this are
unsupported.
Regards,
James
-----Original Message-----
From: Kirk W. Batzer [mailto:[EMAIL PROTECTED]]
Sent: 30 May 2001 00:21
To: 'James H. Cutts III'; [EMAIL PROTECTED]
Subject: RE: Using Net::Ping
This works for me on Win2000 when using "icmp" or "udp".use Net::Ping;$host = "MySrvr";
# $p = Net::Ping->new("tcp");
$p = Net::Ping->new("icmp");
# $p = Net::Ping->new();
print "$host is: ";
if ($p->ping($host)) {
print "alive.\n" ;
}
else {
print "unreachable.\n" ;
}
$p->close();This works with udp (default) and "icmp". For some I can't get "tcp" to work. With "tcp", I get a message: "The Unsupported function alarm function is unimplemented at C:/Perl/lib/Net/Ping.pm line 308".Kirk W. Batzer
[EMAIL PROTECTED]-----Original Message-----I am having difficulty in using Net::Ping.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of James H. Cutts III
Sent: Tuesday, May 29, 2001 1:18 PM
To: [EMAIL PROTECTED]
Subject: Using Net::Ping
The code:Running this code on Win NT and Win 95 returns the same result:
- use Net::Ping;
- $p = Net::Ping->new();
- $host = "aspn.activestate.com";
- print "$host is ";
- print "NOT " if (! $p->ping($host) );
- print "alive\n";
- $host = "199.60.48.99";
- print "$host is ";
- print "NOT " if (! $p->ping($host) );
- print "alive\n";
- $p->close();
aspn.activestate.com is NOT alive 199.60.48.99 is NOT alive
However, at the same time I am able to do a command line PING to both addresses and get a valid return. I've tried it with numerous different hosts, including pinging my own workstation. I never get a live host response.
I've gotten Net::LDAP to work so I know that I've got my network connection working.
Any suggestions on what might be done to get it working. Ping seems to be the simplest to get going so I'm surprised that I'm having difficulty with it.
Thanks.
--------------------------------------------------------------------------------------------------------James H. Cutts IIIITS - RES Computer Project ManagerUniversity of Missouri - Columbia 401 Clark Hall Columbia, MO 65211-4405
E-mail: [EMAIL PROTECTED]
**********************************************************************
This e-mail (including any documents which may accompany it) contains
information which is confidential and may also be privileged.
It is for the exclusive use of the intended recipient(s).
If you are not the intended recipient(s) please note that any form of
distribution, copying or use of this e-mail or the information in it
or attached to it is strictly prohibited and may be unlawful.
If you have received this e-mail in error please notify us immediately
by e-mail to [EMAIL PROTECTED] or telephone +44 (0)207 940 1200 and
delete the e-mail.
Please advise immediately if you or your employer do not consent to
Internet E-Mail for messages of this type.
Information or opinions in this message that do not relate to the
business of Windsor plc and/or subsidiary and/or associated companies
shall be treated as neither given or endorsed by it.
**********************************************************************
