hammerspoon2-docs
    Preparing search index...

    Class HSNetworkPing

    Object representing an active or completed ICMP ping operation. Create instances with hs.network.ping().

    Index

    Constructors

    Properties

    address: string

    The resolved IP address of the target, or "<unresolved address>" if DNS has not yet completed.

    count: number

    The total number of ICMP Echo Requests to send. May be increased while the ping is running provided the new value is greater than the number already sent.

    isPaused: boolean

    true when the ping has been suspended with pause().

    isRunning: boolean

    true while the ping is actively sending and waiting for replies.

    sent: number

    The number of ICMP Echo Requests sent so far.

    server: string

    The hostname or IP address string originally passed to hs.network.ping().

    typeName: string

    Always "HSNetworkPing".

    Methods

    • Immediately stops the ping, firing the "didFinish" callback with statistics collected so far.

      Returns void

    • Returns packet statistics for all sent packets, or for a single packet by its zero-based sequence number.

      Parameters

      • OptionalsequenceNumber: number

        Omit to get all packets as an array; pass an integer to get a single packet object, or null if that sequence does not exist.

      Returns any

      An array of packet objects when called without arguments, or a single packet object (or null).

    • Suspends the ping. No further packets are sent until resume() is called.

      Returns HSNetworkPing | null

      This ping object if still active, or null if the ping has already finished.

    • Resumes a paused ping, continuing from where it left off.

      Returns HSNetworkPing | null

      This ping object if still active, or null if the ping has already finished.

    • Replaces the ping's callback function.

      Parameters

      • callback: (ping: HSNetworkPing, event: string, info: any) => void

        The new callback function.

      Returns HSNetworkPing

      This ping object for chaining.

    • Returns a human-readable summary of the ping results in standard ping format.

      Returns string

      A multi-line string with transmission statistics and round-trip timing.