三次握手简图
TCP建立连接之前要进行三次握手。
三次握手的最终目的就是为了establish a reliable connection between two devices。
This connection is established by using what is known as the Three-way Hand Shake.
-
SYN
the device initiating the connection will transmit a SYN segment, this synchronises the sequence numbers and specifies what the Initial Sequence Number (ISN) will be, the ISN will be incremented by one for each transmitted segment. -
SYN-ACK
The receiver will then reply with a SYN-ACK segment, this acknowledges the request to establish a connection from the initiating device. -
ACK
The third segment that completes the Three-way Handshake process is sent from the initiator is an ACK or acknowledgment message.
三次握手详图
Wireshark抓包
-
SYN
Sequence number (即x) = 0
-
SYN-ACK
Sequence number (即y) = 0
Acknowledgement number = x + 1 = 1
-
ACK
Acknowledgement number = y + 1 = 1