mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-22 03:05:16 +00:00
tcpServer: Handle connection reset
This commit is contained in:
parent
0bfd7a70b2
commit
d1e4466fba
1 changed files with 5 additions and 1 deletions
|
@ -22,12 +22,16 @@ while True:
|
|||
print(f'Switch Connected! IP: {client_address[0]} Port: {client_address[1]}')
|
||||
while True:
|
||||
data = connection.recv(1024)
|
||||
|
||||
if data:
|
||||
print(data.decode("utf-8"), end='', flush=True)
|
||||
else:
|
||||
print(f'Connection Terminated.')
|
||||
break
|
||||
|
||||
except ConnectionResetError:
|
||||
print("Connection reset")
|
||||
|
||||
finally:
|
||||
# Clean up the connection
|
||||
connection.close()
|
Loading…
Reference in a new issue