TCP三次握手(Three-Way Handshake)

三次握手简图

TCP建立连接之前要进行三次握手。


TCP三次握手(Three-Way Handshake)_第1张图片
三次握手

三次握手的最终目的就是为了establish a reliable connection between two devices

TCP三次握手(Three-Way Handshake)_第2张图片
三次握手动态图

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.

三次握手详图

TCP三次握手(Three-Way Handshake)_第3张图片
三次握手详图

Wireshark抓包

Wireshark抓包之三次握手
  • SYN


    TCP三次握手(Three-Way Handshake)_第4张图片
    SYN
Sequence number (即x) = 0
  • SYN-ACK


    TCP三次握手(Three-Way Handshake)_第5张图片
    SYN-ACK
Sequence number (即y) = 0
Acknowledgement number = x + 1 = 1
  • ACK


    TCP三次握手(Three-Way Handshake)_第6张图片
    ACK
Acknowledgement number = y + 1 = 1

References:

https://nettx.co.uk/tag/three-way-handshake

你可能感兴趣的:(TCP三次握手(Three-Way Handshake))