hammerspoon2-docs
    Preparing search index...

    Function ping

    • 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. timeout (seconds per packet, default 2.0), family ("any" | "ipv4" | "ipv6", default "any"), and callback (function).

      Parameters

      • server: string

        A hostname or IP address to ping.

      • Optionaloptions:
            | {
                callback?: (ping: HSNetworkPing, event: string, info: any) => void;
                count?: number;
                family?: string;
                interval?: number;
                timeout?: number;
            }
            | ((ping: HSNetworkPing, event: string, info: any) => void)

        A callback function or options object. Optional.

      Returns HSNetworkPing | null

      An HSNetworkPing object, or null if the arguments are invalid.