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