Detailed introduction of transport layer protocols (focus 4, necessary knowledge of network rookies)
one。 First, let's take a look at the two protocols in the transport layer.
TCP protocol features: security, low efficiency. UDP protocol features: efficient, insecure
II. Detailed introduction of the TCP newspaper paragraph
The TCP protocol is the end-to-end connection and the communication applied to the application.
Source port number: the port number of your own service or application
Destination port number: the port number corresponding to someone else's service or application
Let's take a look at the common port numbers.
Serial number: the sender is numbered for each byte to facilitate the correct reorganization of the receiver
Confirmation number: used to confirm the message on the sender
Head length: the length of this TCP head
Flag bit: URG: emergency pointer bit. If 1 is on, 0 is off. It goes directly to the application layer of the other host without cache.
PSH: quick acceptance and delivery to the application layer, which needs to be cached until a message segment is complete without queuing directly to the application layer.
ACK: confirm connection
PST: reconnect, reset
SYN: request connection
FIN: disconnecting
Window size: used to indicate the number of locally acceptable segments. The window size is variable.
Third, TCP three-way handshake, four waves
Let's understand that first PC1 sends the message requesting a connection, SYN,Seq, which represents the serial number, to PC2.
PC2 sends a confirmation message, ACK, and responds via SYN.
PC1 will confirm this response to ACK.
Four handshakes:
Let's see. First, PC1 sends disconnected messages and confirmation messages FIN and ACK
PC2 will receive a confirmation message.
PC2 will respond again to confirm the disconnected message.
PC1 receives confirmation message ACK
There is also a state where TCP is semi-closed, where PC2 can send data to PC1, but PC1 cannot send data to PC2.