Skip to Main Content
Perl in a Nutshell, 2nd Edition
book

Perl in a Nutshell, 2nd Edition

by Nathan Patwardhan, Ellen Siever, Stephen Spainhour
June 2002
Beginner content levelBeginner
759 pages
80h 42m
English
O'Reilly Media, Inc.
Content preview from Perl in a Nutshell, 2nd Edition

Name

new

Synopsis

$p = Net::Ping->new([proto[, def_timeout[, bytes]]])

Creates a new ping object. All arguments are optional. Takes the following arguments:

proto

The protocol to use when doing a ping. Default is udp. The possible protocols are:

icmp

Sends an icmp echo message to the remote host. If the echoed message is received back correctly from the remote host, that host is considered reachable. Requires the program to be run as root or setuid to root.

tcp

Attempts to establish connection to remote host’s echo port. If successful, remote host is considered reachable. No data is actually echoed. No special privileges are required, but overhead is higher than for the others.

udp

Sends a udp packet to remote host’s echo port. If the echoed packet is received back from the remote host and contains the same data that was sent, the remote host is considered reachable. Requires no special privileges.

def_timeout

Default timeout in seconds to be used if timeout not passed to the ping method. Must be greater than zero; defaults to five seconds.

bytes

Number of bytes included in the ping packet sent to the remote host. Ignored if protocol is tcp. Default is 1 if protocol is udp, otherwise 0. These are also the minimum number of bytes; the maximum is 1,024.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl by Example, Fourth Edition

Perl by Example, Fourth Edition

Ellie Quigley
Perl Cookbook, 2nd Edition

Perl Cookbook, 2nd Edition

Tom Christiansen, Nathan Torkington
Perl in a Nutshell

Perl in a Nutshell

Nathan Patwardhan, Ellen Siever, Stephen Spainhour
Learning Perl, 7th Edition

Learning Perl, 7th Edition

Randal L. Schwartz, brian d foy, Tom Phoenix

Publisher Resources

ISBN: 0596002416Errata Page