(cli)
| 11 | |
| 12 | |
| 13 | def Client_Handler(cli): |
| 14 | while True: |
| 15 | try: |
| 16 | reply = cli.recv(1024).decode("utf-8") |
| 17 | if reply == "QUIT": |
| 18 | index_of_cli = clients.index(cli) |
| 19 | nick = nickename[index_of_cli] |
| 20 | nickename.remove(nick) |
| 21 | clients.remove(cli) |
| 22 | BroadCasating(f"{nick} has left the chat room") |
| 23 | print(f"Disconnected with f{nick}") |
| 24 | break |
| 25 | BroadCasating(reply) |
| 26 | except Exception: |
| 27 | index_of_cli = clients.index(cli) |
| 28 | print(index_of_cli) |
| 29 | nick = nickename[index_of_cli] |
| 30 | nickename.remove(nick) |
| 31 | clients.remove(cli) |
| 32 | BroadCasating(f"{nick} has left the chat room") |
| 33 | print(f"Disconnected with {nick}") |
| 34 | break |
| 35 | |
| 36 | |
| 37 | def BroadCasating(msg): |
nothing calls this directly
no test coverage detected