A simple HTTP Web Server implementation in Python using TCP socket programming. This lab implements a basic web server that handles one HTTP request at a time, serves HTML files, and returns 404 for non-existent resources.
- Python 3.x
webserver.py- The complete web server implementationHelloWorld.html- Test HTML file served by the server
-
Start the web server:
python3 webserver.py
-
Open a web browser and navigate to:
http://localhost:6789/HelloWorld.html- To view the test pagehttp://localhost:6789/Nonexistent.html- To test 404 response
-
Or use your machine's IP address when testing from another host:
http://YOUR_IP:6789/HelloWorld.html
- Listens on port 6789
- Serves static HTML files from the current directory
- Returns
200 OKwith file contents for valid requests - Returns
404 Not Foundfor non-existent files - Uses standard HTTP/1.1 response format
See WebServer_Lab_Submission.docx for the lab report with screenshots demonstrating each step.