TCP3次握手建立連接,4次握手斷開連接

SYN=synchronize ACK=acknowledge FIN=finish

TCP 3-Way Handshake Diagram

Below is a (very) simplified diagram of the TCP 3-way handshake process. Have a look at the diagram on the right as you examine the list of events on the left.

EVENT DIAGRAM

Host A 發送a TCP SYNchronize packet to Host B

Host B receives A's SYN

Host B 發送a SYNchronize-ACKnowledgement

Host A 接收 B's SYN-ACK

Host A 發送 ACKnowledge

Host B 接收  ACK

TCP socket connection is ESTABLISHED.


TCP Three Way Handshake
(SYN,SYN-ACK,ACK)

SYNchronize and ACKnowledge messages are indicated by a either the SYN bit, or the ACK bit inside the TCP header, 首部數據and the SYN-ACK message has both the SYN and the ACK bits turned on (set to 1) in the TCP header.

TCP knows whether the network TCP socket connection is opening, synchronizing, established by using the SYNchronize and ACKnowledge messages when establishing a network TCP socket connection.建立TCP連接

When the communication between two computers ends, another 3-way communication is performed to tear down the TCP socket connection. This setup and teardown of a TCP socket connection is part of what qualifies TCP a reliable protocol. TCP also acknowledges that data is successfully received and guarantees the data is reassenbled in the correct order.傳輸層負責可靠的傳輸,TCP是面向有連接的,之所以可靠是因爲有確認標識和確認機制。

Note that UDP is connectionless. That means UDP doesn't establish connections as TCP does, so UDP does not perform this 3-way handshake and for this reason, it is referred to as an unreliable protocol. That doesn't mean UDP can't transfer data, it just doesn't negotiate how the conneciton will work, UDP just transmits and hopes for the best.UDP沒有TCP的握手流程,因此是不可靠的連接。也因此高效。






發佈了58 篇原創文章 · 獲贊 4 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章