diff --git a/Protocol.md b/Protocol.md index ff3b92b..a1be305 100644 --- a/Protocol.md +++ b/Protocol.md @@ -92,6 +92,30 @@ _stream.Write(BitConverter.GetBytes(data.Length), 0, 4); // Send the length _stream.Write(data, 0, data.Length); // Send the packet ``` +## Request and Reply + +When a request is sent, the receiver must always respond with the same command name, +only the arguments change. +This allow the sender to know if the receiver responded correctly to its request. + +Here is an example with a ping command (without the end `\n`): + +```md +PING +ID;ping +``` + +> Request + +```md +PING +ID;pong +``` + +> Response + +Here, a client send a 'ping' request to a server and the server respond with a 'pong', using the same command. + ## Commands Each command is described in a dedicated page