![]() |
Network Component
Version 7.1
MDK Middleware for IPv4 and IPv6 Networking
|
A Ping Client checks the reachability of a host on IP network. More...
Typedefs | |
typedef void(* | netPing_cb_t )(netPing_Event event) |
Ping Event callback function. | |
Enumerations | |
enum | netPing_Event { netPing_EventSuccess = 0, netPing_EventTimeout } |
Ping Callback Events. More... | |
Functions | |
netStatus | netPing_Echo (const NET_ADDR *addr, netPing_cb_t cb_func) |
Start ICMP ping process. [thread-safe]. | |
A Ping Client checks the reachability of a host on IP network.
The Ping Client is used to test the reachability of a network device on an IP network and to measure the round-trip time for messages sent from the host to a destination node. It operates by sending Internet Control Message Protocol (ICMP) Echo request packets to the target and waiting for an ICMP Echo reply.
void(* netPing_cb_t)(netPing_Event event) |
Ping Event callback function.
[in] | event | - Ping event as defined in netPing_Event. |
Is the type definition for the Ping callback function. Users must provide the function. The callback function uses the event argument to signal one of the following Ping events:
Event | Description |
---|---|
netPing_EventSuccess | Remote host responded to ping. |
netPing_EventTimeout | Ping session has timed out, remote host did not respond. |
Parameter for:
enum netPing_Event |
Ping Callback Events.
Parameter for:
netStatus netPing_Echo | ( | const NET_ADDR * | addr, |
netPing_cb_t | cb_func | ||
) |
Start ICMP ping process. [thread-safe].
[in] | addr | structure containing IP address of remote host. |
[in] | cb_func | callback function to call, when ping session ends. |
The non-blocking function netPing_Echo starts the ping process on the Network Core. This causes the Ping client to send an echo request to the remote IP address. The result of the operation is provided with the callback function.
The argument addr is a pointer to the buffer containing the IP address of the remote host to be pinged.
The argument cb_func points to an event callback function called by the Ping client (running on Network Core) when the ping session ends. Refer to netPing_cb_t.
Code Example