diff --git a/MP1/client.py b/MP1/client.py index 0576f7a..8195f4a 100644 --- a/MP1/client.py +++ b/MP1/client.py @@ -62,7 +62,7 @@ def grep_all_ips(ips, cmd): except Exception as e: print(f"Failed to connect to {ip}:{PORT} - {e}") - match_count.append(0) + match_count.append(-1) finally: client_socket.close() @@ -74,6 +74,9 @@ while True: print("=========================== SUMMARY ===========================") for i, count in enumerate(match_count): + if count == -1: + print(f"machine.{i + 1}.log: Connection failed") + else: print(f"machine.{i + 1}.log: {count} matches") print(f"Total matches: {sum(match_count)}") print("===============================================================") \ No newline at end of file