Skip to content

k.net.ping ​

Probe host connectivity and round-trip time with ICMP

Execution ContextPrerequisitesTypical Use
KScript API, Page / View server scriptsHost network permits outbound ICMP (some cloud hosts block ICMP)Checking hostname reachability and round-trip latency

k.net.ping sends an ICMP Echo request to a specified hostname or IP address and returns the probe result.

Quick Start ​

js
k.api.get("ping", () => {
  const result = k.net.ping("kooboo.com")
  return {
    ip: result.ip,
    milliseconds: result.time,
    reachable: result.success
  }
})

ping() ​

ping(command) sends an ICMP request to a host name or IP address.

ParameterTypeRequiredDescription
commandstringYesHost name or IP address to probe

Returns: PingResult ({ ip: string, time: number, success: boolean }).

FieldDescription
ipResolved IP address
timeRound-trip time in milliseconds
successWhether the ICMP request succeeded
js
const result = k.net.ping("kooboo.com")

return {
  ip: result.ip,
  milliseconds: result.time,
  reachable: result.success
}

TypeScript Definitions ​

ts
interface KNET {
  ping(command: string): PingResult;
}

interface PingResult {
  ip: string;
  time: number;
  success: boolean;
}