TCP/IP notes (1) -- Introduction, tcpip
ZookeeperPreface
I have a poor memory and have forgotten reading books. I have taken this note to record what I know and think after reading the book. This note is just a summary I wrote after reading the book, the right is to review the book later.
I. Why is there a tcp IP protocol?
We know that there are 56 nationalities in China, each of which has its own language, and the language forms barriers for each nation. Everyone speaks their own language and no one understands what the other party is talking about, language is the gap between nations, and no one can cross. As a result, every nation is a small group, and collaboration between nations cannot become a large group. Mandarin solves this problem and builds a bridge between ethnic minorities to allow communication between ethnic minorities and avoid unnecessary conflicts.
The same is true for the TCP/IP protocol. Computer Systems and hardware vary widely. to interconnect each computer, the same communication protocol must be shared among all computers, connect each computer and communicate with each other to form an Internet"
Ii. layer-Based TCP/IP
The tcp IP protocol is divided into four layers, each layer is responsible for different communication functions.
Data link layer: Network Interface and driver
Network Layer: Information in network transmission, processing group activities in network transmission, such as IP protocol. The IP protocol is unreliable. It does not confirm whether the packets are successfully transmitted. This step requires the upper-layer tcp protocol to process
Transport Layer: Responsible for network transmission, mainly divided into tcp and udp, udp is not reliable, it is only responsible for transmitting data to the destination network device, it does not confirm whether it is successfully obtained by the target network device, and the operation such as message confirmation and acceptance needs to be processed by the application layer. Tcp is secure. It includes the acceptance, sending, timeout, retransmission, and other operations to confirm the success of message transmission.
Application Layer: applications, such as http
On the Internet, we can divide the entire system into an end system and an intermediate system:
End System: two hosts on the Internet are both end systems. The application layer and transport layer are used in the end-to-end protocol in the end system. Only the end system can use the application layer and transport layer.
Intermediate System: The intermediate router. The network layer provides the hop-by-hop Protocol applied to the intermediate system. Both the end system and the intermediate system use the network layer.
3. Internet address
Each host has an ip address that identifies it. Even a host can have multiple ip addresses. There are five types of IP addresses:
Iv. Domain Name System
To access hosts on the Internet, we can access them through the host's ip address or through the host domain name. The ip address corresponds to the host domain name.
5. Encapsulation
The two hosts communicate with each other. data must be encapsulated in the protocol stack and then transmitted to the target host:
1. The application assembles the data format and sends it to the kernel protocol stack. Only the application layer is executed in the tcpip layer, and the other three layers are implemented in the kernel protocol stack.
2. The protocol stack receives data from the application layer and adds a tcp or udp header to it. The tcp and udp headers have a 16-bit port number to represent the application layer protocol.
3. encapsulate the ip header and add transmission information. The ip header uses 8 bits to indicate what protocol the upper layer is.
4. encapsulate the Ethernet header, add network excuse information, and use 16 bits to indicate what protocol the upper layer is.
Vi. Sub-Use
When the host receives the packet, it parses the packet from the bottom up, and then delivers the application layer information to the user process.
Servers are generally divided into concurrent servers and duplicate servers:
Concurrent Server: the server starts a process as long as it receives a request from a client. After processing, the server ends the process and can respond to requests from multiple clients at the same time.
Duplicate server: when the server receives a request from the client, the server immediately processes the request. However, when the request from other clients is blocked, the server can respond to the next client only after the current processing is complete.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.