193k views
1 vote
Develop the simple web server.

Works on port 40000.
Supports the HTTP GET command.
Returns 404 error if the file doesn't exist.
Only looks for files in the current directory.
Supports the HTTP POST command.
Places the posted binary file in the current working directory.
Does not support any other functionality.

1 Answer

4 votes

Final answer:

To develop a simple web server on port 40000, use Python. For GET, check if the file exists in the current directory. For POST, save the binary file in the current working directory.

Step-by-step explanation:

To develop a simple web server that works on port 40000 and supports the HTTP GET and POST commands, you can use a programming language like Python.

For the HTTP GET command, you need to listen for incoming requests on port 40000 and parse the requested file path. If the file exists in the current directory, you can return its contents with an HTTP 200 response. If the file doesn't exist, you should return an HTTP 404 error.

For the HTTP POST command, you need to listen for incoming requests on port 40000 as well. When a POST request is received, you can save the binary file in the current working directory.

User Greg Valcourt
by
7.8k points