Advanced AT parser for ESP8266 WiFi module

Ping server and get response time. More...


espr_t esp_ping (const char *host, uint32_t *time, const esp_api_cmd_evt_fn evt_fn, void *const evt_arg, const uint32_t blocking)
 Ping server and get response time from it. More...

Detailed Description

Ping server and get response time.

By pinging external server, you can get response time in units of milliseconds.

ESP_CFG_PING must be enabled to use ping feature
uint32_t time;
/* Try to ping domain and print time */
if (esp_ping("", &time, NULL, NULL, 1) == espOK) {
printf("Ping successful. Time: %d ms\r\n", (int)time);

Function Documentation

◆ esp_ping()

espr_t esp_ping ( const char *  host,
uint32_t *  time,
const esp_api_cmd_evt_fn  evt_fn,
void *const  evt_arg,
const uint32_t  blocking 

Ping server and get response time from it.

[in]hostHost name to ping
[out]timePointer to output variable to save ping time in units of milliseconds
[in]evt_fnCallback function called when command has finished. Set to NULL when not used
[in]evt_argCustom argument for event callback function
[in]blockingStatus whether command should be blocking or not
espOK on success, member of espr_t enumeration otherwise