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]}')
|
print(f'Switch Connected! IP: {client_address[0]} Port: {client_address[1]}')
|
||||||
while True:
|
while True:
|
||||||
data = connection.recv(1024)
|
data = connection.recv(1024)
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
print(data.decode("utf-8"), end='', flush=True)
|
print(data.decode("utf-8"), end='', flush=True)
|
||||||
else:
|
else:
|
||||||
print(f'Connection Terminated.')
|
print(f'Connection Terminated.')
|
||||||
break
|
break
|
||||||
|
|
||||||
|
except ConnectionResetError:
|
||||||
|
print("Connection reset")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Clean up the connection
|
# Clean up the connection
|
||||||
connection.close()
|
connection.close()
|
||||||
|
|
Loading…
Reference in a new issue