This paper is participating in theNetwork protocols must be known and must be known”Essay campaign


Access the client using HTTP

The client and server interact through the HTTP protocol

  • Client: The end that requests access to a data resource
  • Server side: The end that provides data resources


Basic NETWORK TCP/IP

To understand HTTP, it is necessary to understand the TCP/IP protocol family

TCP/IP protocol family

Commonly used networks, including the Internet, operate on the basis of the TCP/IP protocol family, which is a general name for various Internet-related protocols

Layered management of TCP/IP

The TCP/IP protocol family consists of the application layer, transport layer, network layer, and data link layer

  • The application layer

    The application layer determines the activities of communication when providing application services to users

    The TCP/IP protocol family stores various common application services. For example, File Transfer Protocol (FTP) and Domain Name System (DNS) services are two of them, and HTTP is also in this layer

  • The transport layer

    The transport layer provides data transfer between two computers in a network connection to the upper application layer

    There are two different protocols at the transport layer: TCP (Transmission Control Protocol) and UDP (User Data Protocol)

  • The network layer

    The network layer is used to handle packets of data as they flow across the network

    A packet is the smallest unit of data transmitted over a network. This layer defines the path (the so-called transport route) through which the packets are sent to each other’s computers. The role of the network layer is to select a transmission route among many options when it is transmitted to and from the other computer through multiple computers or network devices

  • Data link layer (Network interface layer)

    Used to handle the part of the hardware connected to the network

    It includes the device driver for controlling the operating system, hardware, NIC (Network Interface Card), optical fiber and other physical visible parts (and all transmission media such as connectors). Hardware categories are within the scope of the data link layer

TCP/IP traffic

When the TCP/IP protocol family is used for network communication, the communication with the peer party is hierarchical and sequential. The sender goes down from the application layer, and the receiver goes up from the application layer.

For example 🌰 : take HTTP

1. The client sends an HTTP request at the application layer (HTTP). 2. 4. The server receives the data at the link layer and sends the data to the application layer in sequence. HTTP requests sent by clients are received only when they are transmitted to the application layer

When transmitting data from layer to layer, the sender must print the header information of the layer every time it passes through the layer. The receiver, on the other hand, cancels out the corresponding headers as it passes from layer to layer. This practice of wrapping data information is called encapsulation.


Protocols closely related to HTTP: IP, TCP, and DNS

TCP/IP protocol(Responsible for transmission)

The FUNCTION of IP protocol is to send various packets to each other

All sorts of conditions need to be met to ensure that the transmission actually reaches the other party. Two important conditions are IP address and MAC address. The communication between IP addresses is based on MAC addresses

  • IP address: Specifies the address to which the node is assigned (the IP address is variable)

  • MAC address: fixed IP address of the NIC (MAC address cannot be changed)

  • ARP: a protocol used for address resolution. The MAC address of the communication party can be queried based on the IP address of the communication party

TCPProtocol (to ensure reliability)

The purpose of TCP is to provide reliable byte stream service

  • Byte stream service: To facilitate transmission, a large chunk of data is divided into packet segments for management.

TCP uses the three-way handshake to send data to the destination accurately. TCP flags SYN (Synchronize) and ACK (Acknowledgement) are used during the handshake.

The sender first sends a packet with the SYN flag to the peer. After receiving the packet, the receiving end sends a packet with the SYN/ACK flag to confirm the packet. Finally, the sender sends back a packet with an ACK flag, indicating the end of the handshake. If the handshake is interrupted, the TCP protocol sends the same packets in the same order again.

DNS(Domain name resolution service)

The DNS service is used to resolve domain names and IP addresses

Users usually use host names or domain names to access each other’s computers, rather than directly through IP addresses. That’s because it’s better to remember a computer name as a combination of letters and numbers than as a set of pure numbers for an IP address. The DNS provides the service of searching IP addresses by domain names or reverse-searching domain names from IP addresses

The relationship between various protocols and THE HTTP protocol


The URI and URL

  • URI: Identifies an Internet resource with a string
  • URL: indicates the location of the resource,URLisURIA subset of the