ESP-AT Lib
Advanced AT parser for ESP8266 WiFi module

Ping server and get response time. More...

Functions

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.

Note
ESP_CFG_PING must be enabled to use ping feature
uint32_t time;
/* Try to ping domain example.com and print time */
if (esp_ping("example.com", &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.

Parameters
[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
Returns
espOK on success, member of espr_t enumeration otherwise