forked from Krautspace/doorstatus
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:
parent
fd49e706f3
commit
5522e04840
1 changed files with 7 additions and 1 deletions
|
@ -34,7 +34,7 @@ def read_argument():
|
||||||
buf = input('Enter new status (0/1): ')
|
buf = input('Enter new status (0/1): ')
|
||||||
if buf == '0' or buf == '1':
|
if buf == '0' or buf == '1':
|
||||||
status = buf
|
status = buf
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
@ -58,6 +58,12 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print('Error: {}'.format(e))
|
print('Error: {}'.format(e))
|
||||||
exit()
|
exit()
|
||||||
|
try:
|
||||||
|
res = mySocket.recv(1)
|
||||||
|
print('Server returns: {}'.format(res.decode()))
|
||||||
|
finally:
|
||||||
|
mySocket.close()
|
||||||
|
print('Disconnect from server')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue