elsif ($self->{"proto"} eq "tcp")
{
$self->{"proto_num"} = (getprotobyname('tcp'))[2] ||
croak("Can't get tcp protocol by name");
$self->{"port_num"} = (getservbyname('echo', 'tcp'))[2] ||
croak("Can't get tcp echo port by name");
$self->{"fh"} = FileHandle->new();
}
####
#!/usr/bin/perl
use Net::Ping;
$host="localhost";
$p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
####
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at /usr/lib/perl5/5.00503/i386-linux/Socket.pm line 295.