Introduction - If you have any usage issues, please Google them yourself
Experiment 4 Web server
Requirements: (1) TCP
(2) C/S
(3) http
Abstract: The design of a simple web server, it can handle only one request.
Specifically:
Web server:
Create a connection socket connection When a client (//127.0.0.1/index.html browser, enter the URL:: http)
Http request message is received the connection socket.
Interpret the request to determine the requested file (file name parsing)
Access to documents requested the server s file system.
Create a document requested by the composition of http response packets. (Packet contains a status line+ solid body).
After TCP connection would like to request the browser sends a response. If the file is not in the server browser requests, the server returns 404 Not Found error message.
Note: 1) If port 80 is already in use by another process server port to 5050. Enter the URL of your browser: http: //127.0.0.1: 5050/index.html