Sends ICMP Echo Requests to server and reports results via a callback.
DNS resolution and the first ping begin immediately. The returned object can be used to
pause, resume, or cancel the ping, and to read statistics. The ping runs to completion,
with its callback, even if you don't keep a reference to it.
The options argument may be:
Omitted (or undefined) — uses all defaults.
A callback function — used as the event handler with all other options at their defaults.
An object with any of: count (integer, default 5), interval (seconds, default 1.0),
timeout (seconds per packet, default 2.0), family ("any" | "ipv4" | "ipv6", default "any"),
and callback (function).
The callback receives (ping, event, info):
"didStart" — info is the resolved IP address string.
"didFail" — info is an error message string (e.g. DNS failure).
"sendPacketFailed" — info is [packetObject, errorString].
"receivedPacket" — info is the packet object (see HSNetworkPing.packets()).
Sends ICMP Echo Requests to
serverand reports results via a callback.DNS resolution and the first ping begin immediately. The returned object can be used to pause, resume, or cancel the ping, and to read statistics. The ping runs to completion, with its callback, even if you don't keep a reference to it.
The
optionsargument may be:undefined) — uses all defaults.count(integer, default 5),interval(seconds, default 1.0),timeout(seconds per packet, default 2.0),family("any"|"ipv4"|"ipv6", default"any"), andcallback(function).The callback receives
(ping, event, info):"didStart"— info is the resolved IP address string."didFail"— info is an error message string (e.g. DNS failure)."sendPacketFailed"— info is[packetObject, errorString]."receivedPacket"— info is the packet object (seeHSNetworkPing.packets())."didFinish"— info is the summary string.