{
  "id": "fn-ping",
  "dataComponent": "net",
  "heading": {
    "title": "ping",
    "badges": [
      "Network",
      "ASYNC"
    ]
  },
  "synopsis": "Initiates an asynchronous ping to a given host or IP",
  "codeBlocks": [
    "extend(\"net\")\n\nnet:ping([\n  dest: \"cube.nu11.uk\",\n  count: 5\n], sput)\n\nlocalhost_ping = net:ping(\"127.0.0.1\", sput)\n\nnet:ping([\n  dest: \"cube.nu11.uk\",\n  count: 5\n], sput)\n\neight_ping = net:ping([\n  dest: \"8.8.8.8\"\n], sput)\n\nnine_ping = net:ping([\n  dest: \"9.9.9.9\",\n  interval: 100,\n  count: 20\n], sput)\n\nnet:stop(localhost_ping)"
  ],
  "notes": [
    "The first argument can be a single string (e.g., \"127.0.0.1\") or a keyed array with fields like dest, count, or interval.",
    "The second argument must be a callback function that processes each ping reply.",
    "Returns an integer task ID. Use net:stop(taskId) to cancel an ongoing ping.",
    "If run with proper privileges on Unix, raw ICMP is used; otherwise, the system ping command is used.",
    "You can specify a count to limit the number of pings and an interval (in milliseconds) to adjust the delay between pings."
  ]
}
