Closed Callumator closed 7 months ago
Listing of 1st-level directory contents: The client request should indicate the request type. The server should then construct a list of the names of files/directories at the top level of its current working directory (e.g., using os.listdir()
) and return it to the client over the socket. For the needs of this project, your server should not need to handle subdirectories; i.e., all files served and/or entries returned by os.listdir()
should be those at the top level of the server’s current working directory.
In every case, the server should report (i.e., print on the console) information for every request after its processing is over. This report should be a single line including, at the very least, the IP address and port number of the client, information on the request itself (type and filename, as appropriate) and its status (success/failure). For failures, the report should also include an informative message indicating the type of error. Last, the server should also print informative messages for any other types of errors encountered throughout its execution (again, please only print a single line per error).
Adding the list function to the server.
Client request - request type