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.
This commit is contained in:
berhsi 2019-07-26 22:02:01 +02:00
parent fd49e706f3
commit 5522e04840

View file

@ -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__':