Ping::ICMPPinger
Native Crystal ICMP ping using SOCK_DGRAM + IPPROTO_ICMP. On macOS regular users can open ICMP datagram sockets without root. Each ping session runs in a dedicated OS thread (Fiber::ExecutionContext::Isolated) so it doesn't block the UIng event loop on the main thread.
Constants
DEFAULT_INTERVAL = 1.second
ECHO_REQUEST = 8_u8
HEADER_SIZE = 8
IPPROTO_ICMP = Socket::Protocol.new(1)
PACKET_SIZE = HEADER_SIZE + PAYLOAD.bytesize
PAYLOAD = "CrystalPingMon "
TIMEOUT = 2.seconds
Constructors
Class methods
Instance methods
running?
Sourcestop
Sourcewait_for_completion
Source