Skip to content

Commit 8f3b880

Browse files
committed
fixing except block diractly handles base Exception
1 parent f045227 commit 8f3b880

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Python_chatting_application/server.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def Client_Handler(cli):
2323
print(f"Disconnected with f{nick}")
2424
break
2525
BroadCasating(reply)
26-
except:
26+
except Exception:
2727
index_of_cli = clients.index(cli)
2828
print(index_of_cli)
2929
nick = nickename[index_of_cli]
@@ -38,6 +38,7 @@ def BroadCasating(msg):
3838
for client in clients:
3939
client.send(bytes(msg, "utf-8"))
4040

41+
4142
def recieve():
4243
while True:
4344
client_sckt, addr = s.accept()
@@ -48,7 +49,8 @@ def recieve():
4849
clients.append(client_sckt)
4950
print(f"{nick} has joined the chat room ")
5051
BroadCasating(f"{nick} has joined the chat room say hi !!!")
51-
threading._start_new_thread(Client_Handler , (client_sckt , ))
52+
threading._start_new_thread(Client_Handler, (client_sckt,))
53+
5254

5355
recieve()
54-
s.close()
56+
s.close()

0 commit comments

Comments
 (0)