This is a record 前端面试的话术集锦第十七篇博文——高频考点(TCP知识点)
and I will keep updating this blog post. ❗❗❗
First, let’s answer TCP
the relevant part of this frequently asked interview question, and then study this protocol in detail.
1. What is the difference between UDP and TCP?
TCP
Basically, it's UDP
the other way around. To establish a connection or disconnect it, a handshake is required first. In the process of transmitting data, various algorithms are used to ensure the reliability of the data. Of course, the problem it brings is that it is UDP
not so efficient in comparison.
2. Head
From this picture we can see that the head is much more complicated TCP
than the head.UDP
For TCP
the header, the following fields are very important
-
Sequence number
, this sequence number ensures thatTCP
the transmitted messages are all in order, and the peer can splice the messages in sequence through the sequence number. -
Acknowledgement Number
, this sequence number indicates the number of the next byte that the data receiving end expects to receive, and also indicates that the data with the previous sequence number has been received. -
Window Size
, window size, indicating how many bytes of data can be received, used for flow control -
identifier
-
URG=1
-