private void Communication_Begin(SocketWrapper socket) { var stop = false; while (!stop) { var command = socket.ReadString(); switch (command) { case Connection.STOP: stop = true; socket.Close(false); this.IsConnectionInProgress = false; break; case Connection.EXIT: stop = true; this.IsExiting = true; break; default: this.Execute(socket, command); break; } } }
private string Communication_SendPayload(SocketWrapper client, string request) { int sent = client.WriteString(request); var response = client.ReadString(); return response; }