Command: PING
PING
Description
Sends a PING command to the server and receives a PONG response.
Optionally, arguments can be passed which are echoed back after PONG
.
This is commonly used to check if the server is responsive (like a health check or heartbeat).
Syntax
PING [<args>]
-
PING
: The base command -
<args>
(optional): Any additional string(s) you want to send. The server will echo them back afterPONG
.
Examples
Example 1: Simple Ping
Input:
localhost:9219> ping
Output:
Ok PONG
Example 2: Case-insensitive Command
Input:
localhost:9219> PING
Output:
Ok PONG
Example 3: Ping with Arguments
Input:
localhost:9219> ping hello world
Output:
Ok PONG hello world
Behavior
-
The server reads the command using the
Cmd
structure. -
It prepends
PONG
to the joined string of provided arguments. -
Returns the full response as
PONG <args>
. -
The result is wrapped in a
comm.Response
object and sent back asCmdResponse
.
Use Cases
-
Connectivity test between client and server.
-
Latency/response check.
-
Debugging input arguments being received by the server.