Chapter one introduces the Web and network basics
HTTP is often translated as hypertext Transfer Protocol, but less rigorously, it should be called Hypertext Transfer Protocol.
TCP/IP protocol family
There are all sorts of things in agreements. From cable specifications to the selection of IP addresses, the method of finding remote users, the sequence of communication between the two parties, and the Web page display of the steps that need to be handled, and so on. A collection of protocols associated with the Internet like this is collectively called TCP/IP. It is also said that TCP/IP refers to TCP and IP. Another view is that TCP/ IP is the general name of the protocol family used in IP protocol communication.
Layered management of TCP/IP
An important aspect of the TCP/IP protocol family is layering. The TCP/IP protocol family is divided into four layers: application layer, transport layer, network layer, and data link layer.
There are benefits to having TCP/IP layered. For example, if the Internet was governed by only one protocol, when a design change was needed somewhere, it would have to be replaced entirely. After layering, you only need to replace the changing layers. Once the interfaces between the layers are laid out, the internal design of each layer is free to change.
The functions of each layer of the TCP/IP protocol family are as follows.
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. The HTTP protocol is also in this layer.
The transport layer
Transport layer Provides data transfer between two computers in a network connection to the upper application layer. At the transport layer, there are two different protocols: Transmission Control Protocol (TCP) and User Data Protocol (UDP).
Network layer (also known as network interconnection 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
Link layer (also known as 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 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.
Let’s use HTTP as an example. First, the sending client makes an HTTP request at the application layer (HTTP protocol) to view a Web page.
In order to facilitate transmission, the transport layer (TCP) divides the data (HTTP request packets) received from the application layer, marks the serial number and port number of each packet and forwards it to the network layer.
At the network layer (IP protocol), add the MAC address as the communication destination and forward the MAC address to the link layer. This way, the communication request to the network is ready
The server at the receiving end receives data at the link layer and sends the data to the upper layer in sequence, all the way to the application layer. 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 encapsulate.