From 5522e04840cd1a8a5246f0cbe4b369cf7f32c810 Mon Sep 17 00:00:00 2001 From: berhsi Date: Fri, 26 Jul 2019 22:02:01 +0200 Subject: [PATCH] client-clear.py: bugs in main() and read_argument() fixed read_argument(): return now outside from while loop. loop works now until a valid value ist entered. main(): reads now a return value from server and close the socket. --- client-clear.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client-clear.py b/client-clear.py index facd88d..191092b 100755 --- a/client-clear.py +++ b/client-clear.py @@ -34,7 +34,7 @@ def read_argument(): buf = input('Enter new status (0/1): ') if buf == '0' or buf == '1': status = buf - return buf + return buf def main(): @@ -58,6 +58,12 @@ def main(): except Exception as e: print('Error: {}'.format(e)) exit() + try: + res = mySocket.recv(1) + print('Server returns: {}'.format(res.decode())) + finally: + mySocket.close() + print('Disconnect from server') if __name__ == '__main__':