From f1066a365e56c1628c29a12cb086def0890d33b8 Mon Sep 17 00:00:00 2001 From: Sem van der Hoeven Date: Fri, 18 Sep 2020 14:41:18 +0200 Subject: [PATCH] comments on program.cs --- RH-Engine/Program.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/RH-Engine/Program.cs b/RH-Engine/Program.cs index 1207577..31cd4b5 100644 --- a/RH-Engine/Program.cs +++ b/RH-Engine/Program.cs @@ -18,7 +18,6 @@ namespace RH_Engine //new PC("T470S", "Shinichi"), //new PC("DESKTOP-DHS478C", "semme"), new PC("NA", "Ralf"), - new PC("NA", "Bart") }; private static void Main(string[] args) { @@ -29,6 +28,11 @@ namespace RH_Engine } + /// + /// writes a message to the server + /// + /// the network stream to use + /// the message to send public static void WriteTextMessage(NetworkStream stream, string message) { byte[] msg = Encoding.ASCII.GetBytes(message); @@ -42,6 +46,11 @@ namespace RH_Engine //Console.WriteLine("sent message " + message); } + /// + /// reads a response from the server + /// + /// the network stream to use + /// the returned message from the server public static string ReadPrefMessage(NetworkStream stream) { byte[] lengthBytes = new byte[4]; @@ -66,7 +75,10 @@ namespace RH_Engine return Encoding.UTF8.GetString(buffer, 0, totalRead); } - + /// + /// connects to the server and creates the tunnel + /// + /// the network stream to use private static void CreateConnection(NetworkStream stream) { WriteTextMessage(stream, "{\r\n\"id\" : \"session/list\"\r\n}"); @@ -180,7 +192,9 @@ namespace RH_Engine } - + /// + /// struct used to store the host pc name and user + /// public readonly struct PC { public PC(string host, string user)