HTTP protocol, Hyper-text Transfer Protocol
a. The HTTP protocol is now using version 1.1.
B.The HTTP protocol is the application-layer protocol, which requires the transmission of data using a reliable transport protocol. Typically the Transport layer protocol uses the TCP protocol
C. The TCP protocol specifies how data is transferred between two computers.
D. The HTTP protocol specifies the format of the transmitted data so that both computers understand what the other sends
e. The HTTP protocol specifies that the communication pattern between the client and the server must follow the 1 request-once response communication process
F.The client (request) is initiated by the client (who is the client who sent the requests), which is usually the browser. The server then receives and outputs the request, and then responds (Response)
G.An improvement in the HTTP1.1 version compared to the 1.0 version is that one TCP connection can make multiple requests
With the response. While version 1.0, a TCP connection can only make one request response at a time (multiple request responses
The completion of the work is expensive, because the content of the page now has text content picture content and so on if a request once response too slow, can not meet the demand).H.HTTP requests (request)
The request has a client sent to the service-side specific format specified in the HTTP protocol.
A request consists of three parts:
1. Request Line: The request line is a line of string in the format: Method URL Protocol (CRLF)
Example: get/index.html http/1.1 (CRLF)
CR: Carriage return, corresponding code: 13
LF: Line break, corresponding code: 10
Note: The carriage return refers back to the beginning and the newline is to the next line. Now the carriage return is actually carriage return add line (enter)
2. message headers
3. Message Text
Create webserver service-side infrastructure
Create the Com.tedu.webserver.core package and add the primary class to the package: webserver
This class is responsible for looping the connection of the receiving client and initiating the thread to handle the interaction of a client
This structure is consistent with the previous chat room service-side structure
The thread task has the ClientHandler class complete and is defined in the core package
In the ClientHandler run method, read the contents of the client and view
HTTP protocol, Hyper-text Transfer Protocol