HTTP need to master the knowledge Point (i)

Source: Internet
Author: User
Tags ack domain name lookup file transfer protocol

Hypertext Transfer Protocol (Http,hypertext Transfer Protocol) is one of the most widely used network protocols on the Internet. HTTP is also a subset of the TCP/IP protocol family, and to learn HTTP, you need to understand TCP/IP first.

Hierarchical management of 1-TCP/IP

    The important point in the TCP/IP protocol family is the layering, which is divided into the following 4 layers: application layer, Transport layer, network layer, Data link layer .

The benefit of layering is that the protocol changes between layers can be mutually exclusive and need to be programmed according to the interface.

    • Application Layer
        The application layer determines the activities that communicate with the user when the application service is provided. All kinds of common application services are stored in the TCP/IP protocol family.

Includes HTTP,FTP(file Transfer Protocol, Files Transfer Protocol),DNS(domain Name System, nameservers) services.

    • Transport Layer
      The transport layer provides data transfer between two computers that are in a network connection.

There are two protocols of different nature:TCP(transmission Control Protocol, transmission Protocol) and UDP(user data Protocol, Subscriber Datagram Protocol)

    • Network layer
      The network layer is used to process packets that flow over the network, and the packet is the smallest unit of data transmitted over the network. This layer specifies the path to the other computer and sends the packets to each other.

When transferring from one computer or network device to another, the network layer's role is to select a transmission route within a multitude of options.

    • Link Layer
      The hardware part that is used to process the connected network. The categories on the hardware are within the scope of the link layer.

2-TCP/IP Communication Transport Stream

As shown in 1, when transmitting data between layers and layers, each layer is bound to be hit with the header information that the layer belongs to. Conversely, the receiving end in the layer and layer transfer data, each pass through a layer will be the corresponding header elimination.
This wrapping of data information becomes encapsulated.

Figure 1-http Communication Transmission process3-protocols that are closely related to HTTP: IP, TCP, and DNS
  • 3.1 is responsible for transmitting the IP protocol
    ip (Internet Protocol) Internet Protocol is located at the network layer IP address and MAC address . The IP address can be paired with the MAC address, the IP address can be transformed, but the MAC address will not change.
    on the network, the two sides of the communication on the same local area network (LAN) are rare, usually through multiple computers and network devices to connect to each other. While in transit, the next relay device's MAC address is used to search for the next transit target. At this point, the ARP (Address Resolution Protocol) protocol is used. ARP is a protocol to resolve the address, according to the IP address of the communication party can be used to detect the corresponding MAC address.

  • 3.2 TCP protocol to ensure reliability
    TCP is located in the transport layer, providing a reliable byte stream service   . a byte-stream service is a packet that divides chunks of data into packet segments (segment) for management
    To ensure accuracy, the TCP protocol employs a three-time handshake (Three-way handshaking) strategy. The TCP flag--syn (Synchronize), ACK (acknowledgement), and FIN (finish) are used during the handshake.

TCP establishes a connection-three handshake : the sending side first sends a packet with a SYN flag to the other. When received, a packet with a syn/ack flag is sent back to convey the confirmation message. Finally, the sender sends back a packet with an ACK flag, representing the end of the handshake, as shown in Figure 2.

Figure 2-tcp Establishing a connection-three-time handshake

TCP Release connection-four handshake : The sending side first sends a packet with a FIN flag to the other, then enters the fin-wait-1 state. The receiving end can not immediately disconnect (prevent data loss), send a packet with an ACK flag, at this time the sending side into the fin-wait-2 state. Then the receiving end will not transmit the data to continue to pass, after the transmission of a packet with an ACK and FIN flag, notify the sending side. The sending side sends the ACK flag packet to the receiving end and enters the time-wait state, waiting for 2MSL to disconnect.

Figure 3-tcp Release connection-four-time handshake
    • 3.3 DNS Service for Domain name resolution
      The DNS (Domain Name System) service is an application-level protocol that is the same as the HTTP protocol. It provides the parsing service between the domain name and the IP address. Users typically visit each other's computers via their host name or domain name, and the computer queries the server via an IP address. So DNS provides the domain name lookup IP address and the service to reverse the domain name from the IP address.

  The functions of the above three protocols in the HTTP communication process can be represented by a graph:

Figure 4-http The functions of each protocol in the communication process

HTTP need to master the knowledge Point (i)

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.