FabGL
ESP32 Display Controller and Graphics Library
ICMP Class Reference

ICMP Implementation. More...

#include <ICMP.h>

Detailed Description

ICMP Implementation.

Used to ping a network device using its IP or its host name.

Example:

fabgl::ICMP icmp;
while (true) {

  // CTRL-C ?
  if (Terminal.available() && Terminal.read() == 0x03)
    break;

  int t = icmp.ping("www.fabgl.com");
  if (t >= 0) {
    Terminal.printf("%d bytes from %s: icmp_seq=%d ttl=%d time=%.3f ms\r\n", icmp.receivedBytes(), icmp.hostIP().toString().c_str(), icmp.receivedSeq(), icmp.receivedTTL(), (double)t/1000.0);
    delay(1000);
  } else if (t == -2) {
    Terminal.printf("Cannot resolve %s: Unknown host\r\n", host);
    break;
  } else {
    Terminal.printf("Request timeout for icmp_seq %d\r\n", icmp.receivedSeq());
  }

}
Examples
SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino, and VGA/NetworkTerminal/NetworkTerminal.ino.

Definition at line 87 of file ICMP.h.


The documentation for this class was generated from the following files: