From 9a10d0a007d3fa64f80b6cbe9204b5f50f91ae76 Mon Sep 17 00:00:00 2001 From: Eveldee Date: Tue, 19 Mar 2019 17:47:20 +0000 Subject: [PATCH] Update page 'Protocol' --- Protocol.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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