catch KeyboardInterrupt

This commit is contained in:
2021-04-25 12:24:41 +02:00
parent 0c11b0293c
commit 9af55c9b76
6 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,6 @@ try:
while True:
m = socket.recv_string()
DATETIMES.append(datetime.now())
except Exception as e:
print(e)
except KeyboardInterrupt:
socket.close()
print(DATETIMES)

View File

@ -14,5 +14,5 @@ msg_body = "a" * n
try:
while True:
socket.send_string(f"test {msg_body}")
except Exception:
except KeyboardInterrupt:
socket.close()