2.1 application layer protocol principles
Client Server Architecture
The application layer protocol defines how application processes running on different end systems transmit packets to each other.
Switch packet type, packet type syntax, field meaning, process time, how to send packets and packet response rules
2.2 web applications and HTTP protocol
The Web application layer protocol is hypertext transfer protocol, which is the core of the web.
A web page consists of objects, which are simply files.
The Web browser implements the HTTP client
The Web server is used to store web objects. Each object has URL addressing.
HTTP defines how the Web Client Requests web pages from the server and how the server sends web pages to the client.
HTTP uses TCP as its transport layer transport protocol
HTTP is a stateless protocol
The Web Server Always Opens and has a fixed IP address.
Non-persistent connection and persistent connection: Determine whether each request response is sent through a single TCP connection or all requests and responses are sent through the same TCP connection, previous non-persistent connection and later persistent connection
HTTP message format
1. HTTP Request Message
GET/somedir/page.html HTTP/1.1 (request line)
HOST: www.somescholl.edu is followed by the first line
Connection: Close (using a non-persistent connection)
User-Agent: Mozilla/4.0 (client type)
Accept-language: FR
2. Http response packets
HTTP/1.1 200 OK status line
Connection: first line after close
Date: Thu, 03 Jul 2003 GMT
Server: Apache/1.3.0 (UNIX)
Last-modified: Sun, 6 May 2007 GMT
Content-Length: 6821
Content-Type: text/html
(Data data...) Entity
Status Code: 200 OK. The request is successful. The information is contained in the returned Response Message.
301 moved permanently object has been permanently transferred
400 bad request common error code, the request is not understood by the server
404 Not found the requested document is not on the server
505 HTTP Version Not Supported
User-server interaction: cookie
COOKIE: 1. the HTTP response message contains a cookie header line.
2. the HTTP request message contains a cookie header line.
3. A cookie file is retained by the user's browser.
4. The web site has a backend database
Suan accesses Amazon through a browser. After the request message arrives at Amazon, the Web site generates a unique ID code and uses this as an index to generate a table item in its backend database. Next, Amazon
The server uses a set-COOKIE: the first line of HTTP response packet to respond to Susan's browser. Susan's browser
When an HTTP response packet is received, it will see the set-COOKIE: Header
Web Cache
The Web Cache is also called a proxy server.
Condition get
File Transfer Protocol FTP
Text transfer protocol. Running on TCP, FTP uses two parallel TCP connections to transmit files
One Control connection 21, one data connection 20, and the FTP control information is transmitted out of band.
FTP commands and answers
The user sends a user ID to the server.
Pass User Password
List all files in the current directory of the Request Server
RETR retrieves files from the current directory
Stor current directory stores files
Status code 331 username OK
DNS Internet Directory Service
DNS 1 a distributed database implemented by a layered DNS Server
2. An application layer protocol that allows hosts to query distributed databases
The DNS protocol runs on UDP
Request URL Process
1 client with DNS applications running on the same host
2. the browser extracts the Host Name and sends it to the DNS Client.
3. the DNS client sends a request containing the host name to the DNS server.
4. the DNS client receives an answer packet to address the IP address of the host name.
5. When the browser receives the dns ip address, the HTTP server located by the IP address can send a TCP connection.