#
hs.network.ping.echoRequest
Provides lower-level access to the ICMP Echo Request infrastructure used by the hs.network.ping module. In general, you should not need to use this module directly unless you have specific requirements not met by the hs.network.ping module and the hs.network.ping
object methods.
This module is based heavily on Apple's SimplePing sample project which can be found at https://developer.apple.com/library/content/samplecode/SimplePing/Introduction/Intro.html.
When a callback function argument is specified as an ICMP table, the Lua table returned will contain the following key-value pairs:
checksum
- The ICMP packet checksum used to ensure data integrity.code
- ICMP Control Message Code. This should always be 0 unless the callback has received a "receivedUnexpectedPacket" message.identifier
- The ICMP packet identifier. This should match the results ofhs.network.ping.echoRequest:identifier unless the callback has received a "receivedUnexpectedPacket" message.payload
- A string containing the ICMP payload for this packet. The default payload has been constructed to cause the ICMP packet to be exactly 64 bytes to match the convention for ICMP Echo Requests.sequenceNumber
- The ICMP Sequence Number for this packet.type
- ICMP Control Message Type. Unless the callback has received a "receivedUnexpectedPacket" message, this will be 0 (ICMPv4) or 129 (ICMPv6) for packets we receive and 8 (ICMPv4) or 128 (ICMPv6) for packets we send._raw
- A string containing the ICMP packet as raw data.
In cases where the callback receives a "receivedUnexpectedPacket" message because the packet is corrupted or truncated, this table may only contain the _raw
field.
#
API Overview
Constructors - API calls which return an object, typically one that offers API methods
echoRequest
Methods - API calls which can only be made on an object returned by a constructor
acceptAddressFamily hostAddress hostAddressFamily hostName identifier isRunning nextSequenceNumber seeAllUnexpectedPackets sendPayload setCallback start stop