From 2ec0be3a8260ff18e7b0bd0ade784c95fb964666 Mon Sep 17 00:00:00 2001 From: Aryan Singh Date: Sat, 12 Sep 2026 11:18:28 -0500 Subject: [PATCH] Update server.py --- MP1/server.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/MP1/server.py b/MP1/server.py index d7b2253..3598aaa 100644 --- a/MP1/server.py +++ b/MP1/server.py @@ -38,13 +38,15 @@ while True: print(f"Connected by {addr}") command = receive_message(conn) - # print("Received Grep Command:", command.decode()) + if command is None: + conn.close() + continue - command_args = shlex.split(command.decode()) + command_args = shlex.split(command) if not command_args or command_args[0] != "grep": response = "Invalid command. Please use the 'grep' command." - conn.sendall(response.encode()) + send_message(conn, response) conn.close() continue