From cc539814d86940cce761f5c245c5818d3e36aceb Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sat, 12 Sep 2026 19:59:00 -0500 Subject: [PATCH] minor fix --- MP1/client.py | 3 ++- MP1/server.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MP1/client.py b/MP1/client.py index cfa9d63..0fd6e1f 100644 --- a/MP1/client.py +++ b/MP1/client.py @@ -27,7 +27,7 @@ def receive_exact(sock, num_bytes): while len(received_data) < num_bytes: chunk = sock.recv(num_bytes - len(received_data)) if not chunk: - break + raise ConnectionError("connection closed before the full message arrived") received_data += chunk return received_data @@ -62,6 +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) finally: client_socket.close() diff --git a/MP1/server.py b/MP1/server.py index 38ac702..147b896 100644 --- a/MP1/server.py +++ b/MP1/server.py @@ -25,7 +25,7 @@ def receive_exact(sock, num_bytes): while len(received_data) < num_bytes: chunk = sock.recv(num_bytes - len(received_data)) if not chunk: - break + raise ConnectionError("connection closed before the full message arrived") received_data += chunk return received_data @@ -56,7 +56,7 @@ while True: command_args.insert(1, "-n") - result = subprocess.run(command_args, capture_output=True, text=True) + result = subprocess.run(command_args, cwd="~/fa26_cs425_.group-mp_.team-01/MP1" capture_output=True, text=True) send_message(conn, result.stdout + result.stderr)