Computer Network Notes sorting

Source: Internet
Author: User
Tags tld file transfer protocol
Document directory
  • HTTP (Hypertext Transfer Protocol)
  • FTP (file transfer protocol ):
  • Email Service
  • DNS (Domain Name System)
  • TCP three-way handshake
  • TCP broke up four times
The application layer protocol defines how application processes in different end systems communicate, that is, how packets are transmitted to each other:
  • The type of the exchanged message, for example, request message and Response Message;
  • Syntax of various message types: for example, each keyword segment in the message and its detailed description;
  • Message semantics: Meaning of the information contained in the field;
  • Rules on when and how a process sends packets and responds to the packets.
HTTP (Hypertext Transfer Protocol)
  • Use TCP as the transport layer protocol;
  • It does not save any status information of the client. It is a stateless protocol;
  • The default port number is 80;
  • Non-persistent connection: each request/response pair is sent through a separate TCP connection, that is, the TCP connection is closed after each response;
  • Persistent connection: All request/response pairs of the same client are sent over the same TCP connection. Generally, a timeout interval is set;
  • 404: not found, the request document is not on the server; 400: Bad request, the request cannot be understood by the server;

COOKIE: interaction between the user and the server, allowing the site to track the userCookie consists of four components:

  1. In the HTTP Response Message, there is a cookie header line: set-COOKIE: cookie-id. The cookie-ID is the unique identifier generated by the server for the current user;
  2. There is a cookie header line in the HTTP request message to facilitate the server to track users;
  3. Saves a cookie file in the client system and is managed by the browser. When a user accesses a site that saves the cookie, the browser automatically fills in the cookie header line in the message;
  4. Store a cookie database in the server system and store information of all users.
Cookie workflow:
  1. The client accesses a new site;
  2. The server creates an ID for the customer, saves it to the cookie database, and adds the first line: set-COOKIE: cookie-ID in the response message;
  3. The client browser saves the cookie-ID to the cookie file and adds the first line: COOKIE: cookie-ID in the request message sent to the site later;
Web Cache: Proxy Server
  1. The browser establishes a TCP connection to the Web cache and sends a request message to the Web cache;
  2. The Web Cache checks whether a copy of the object is stored locally. If yes, it sends a conditional GET request packet (if-modified-since flag) to the initial server ), check whether the local copy is the latest. The server returns a response message. If it is the latest, the response message does not contain the request object. If it is not the latest, the response message contains the request object, the Web Cache updates its local storage and the corresponding if-modified-since tag. If no, send a request message to the initial server. After receiving the request, update the local storage. Send response packets to the client browser.
FTP (file transfer protocol ):
  • Control connection: Port Number 21 exists throughout FTP transmission;
  • Data Connection: Port 20 is used. A new data connection is created during each transmission.
Email Service
  • SMTP (Simple Mail Transfer Protocol): Simple Mail transmission protocol, is a push type protocol, each message uses 7 ASCII code;
  • POP3 (Post Office Protocol-Version3): the third version of the post office access protocol, is a pull (pull) type protocol;
  • IMAP (Internet Mail Access Protocol): Internet mail access protocol, which provides users with commands to remotely create folders and move emails in folders;
  • HTTP: Web-based email access protocol.
DNS (Domain Name System)
  • A Distributed Database implemented by a layered DNS server: Root DNS server; top-level domain (TLD) servers (such as COM, org, net, Edu, Gov); authoritative DNS server, map the Host Name and IP address.
  • An application layer protocol that allows hosts to query distributed databases. UDP is used as the transport layer protocol.
DNS Working Mechanism
  1. The host sends a request to the local DNS server;
  2. The local DNS server checks whether the request is cached in the DNS cache. If not, perform Step 3. If yes, directly return a response message.
  3. The local DNS server forwards the message to the root DNS server, and the root DNS server returns the correct TLD Server IP address;
  4. The local DNS server forwards the message to the TLD server, and the TLD server returns the correct IP address of the authoritative DNS server;
  5. The local DNS server forwards the message to the authoritative DNS server. The authoritative DNS server returns the response message, and the local DNS Server caches the query structure (usually valid for 2 days) and jumps to step 2;
Transport Layer
  • TCP (Transfer Control Protocol): connection-oriented, reliable data transmission protocol. The header is 20 bytes (Source Port Number 2 byte, destination port number 2 byte, confirmation number 4 byte, serial number 4 byte, length 1 byte, flag 1 byte, receiving window 2 byte, inspection checksum 2 byte and emergency Data Pointer 2 byte ), the validation number for filling TCP datagram into the header is the serial number of the expected datagram. TCP establishes a TCP connection based on the four tuples (source IP address, source port number, destination IP address, and destination port number). That is to say, the server will establish different TCP connections for each client.
  • User Data Protocol (UDP): connectionless and unreliable data transmission protocol. The header is 8 bytes (source port number, destination port number, length, validation checksum ). UDP establishes a connection based on the binary group (destination IP address and destination port number), that is, the server establishes the same UDP connection for all clients.
TCP three-way handshake
  1. The client sends a SYN packet segment (SYN = 1, seq = clien_isn) to the server to request a TCP connection;
  2. The server allocates TCP cache and variables for the TCP connection, and sends a synack packet segment (SYN = 1, seq = server_isn, ACK = client_isn + 1) to the client ), confirm that the connection can be established;
  3. The client allocates TCP cache and variables for the TCP connection and sends an ACK packet segment (SYN = 0, seq = client_isn + 1, ACK = server_isn + 1) to the client ), confirm that the connection is established. This time can carry a payload.
TCP broke up four times
  1. The client sends a FIN packet segment to the server, indicating that the client has no data to send to the server and requests to close the connection;
  2. The server sends an ACK packet to the client and confirms that the connection can be closed;
  3. The server sends a FIN packet segment to the client, indicating that the server has no data to send to the client and requests to close the connection;
  4. The client receives the FIN packet segment and sends the ACK packet segment to the server. wait 30 seconds and close the connection. The server closes the connection after receiving the Ack.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.