Skip to content

Commit

Permalink
fixing except block diractly handles base Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
slowy07 committed Jul 17, 2021
1 parent f045227 commit 8f3b880
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Python_chatting_application/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def Client_Handler(cli):
print(f"Disconnected with f{nick}")
break
BroadCasating(reply)
except:
except Exception:
index_of_cli = clients.index(cli)
print(index_of_cli)
nick = nickename[index_of_cli]
Expand All @@ -38,6 +38,7 @@ def BroadCasating(msg):
for client in clients:
client.send(bytes(msg, "utf-8"))


def recieve():
while True:
client_sckt, addr = s.accept()
Expand All @@ -48,7 +49,8 @@ def recieve():
clients.append(client_sckt)
print(f"{nick} has joined the chat room ")
BroadCasating(f"{nick} has joined the chat room say hi !!!")
threading._start_new_thread(Client_Handler , (client_sckt , ))
threading._start_new_thread(Client_Handler, (client_sckt,))


recieve()
s.close()
s.close()

0 comments on commit 8f3b880

Please sign in to comment.