[Jiangwang] [TCP] Analysis of TCP three-way handshake

foreword

  • I was not serious when I was studying network planning before, and the TCP three-way handshake passed away in a daze. Recently, I am re-checking for gaps in the knowledge of network planning. I have to eat one bite at a time, so I didn’t write a lot of knowledge points involved in this blog. Among them, this article is only a glimpse of the leopard, and I will write it in detail later.

  • Some of the notes in the notes have been sorted out after personal understanding, and there may be deviations. Readers are also kindly requested to help point out, thank you.

disclaimer

  • For convenience, some of the pictures used in this article come from the Internet. If there is any infringement, please contact the blogger to delete it. Thanks to other bloggers for their pictures.
  • This note is used to record my summary of this knowledge. To facilitate future work and study.
  • If there is any infringement, please inform and delete it immediately.

[What is it?

  • TCP three-way handshake: refers to the process of establishing a TCP connection between the client and the server

【Why?

  • Confirm that the sending and receiving of yourself and the other party are normal, thus ensuring reliable communication between the two parties.

  • When the client and the server establish a TCP connection, both communicating parties must obtain information from each other . In order to determine that the two parties are the objects to establish a link with each other .

    • The information that both parties need to know includes
      1. The start sequence number of the other party's message transmission .
      2. The buffer size of the data sent by the other party .
      3. The maximum segment length MSS that can be received .
      4. Supported TCP options

【How to do it?

first

  • The client sends a SYN (seq=j) packet to the server and enters the SYN_SENT state, waiting for the server to confirm

    • SYN : Synchronize Sequence Numbers
      • seq : Indicates the serial number of this tcp packet
    • SYN_SENT : Indicates a connection request
  • [Proof] The client has the ability to send

the second time

  • When the server receives the syn packet, it must confirm the client's SYN (ack=j+1), and at the same time, it also sends a SYN packet (seq=k), that is, the SYN+ACK packet . At this time, the server enters the SYN_RECV state.

    • ACK : Indicates the confirmation number of this package , which proves that the sent data has been confirmed to be received correctly
    • SYN_RECV : Indicates that the server is temporarily unable to provide normal TCP services. Use this to deny other requests.
  • [Proof] The server has the ability to send, and the client has the ability to receive

the third time

  • The client receives the SYN+ACK packet from the server and sends an acknowledgment packet ACK (ack=k+1) to the server. After the packet is sent, the client and server enter the ESTABLISHED state and complete the three-way handshake.

    • ESTABLISHED : Indicates that the TCP connection is successful
  • [Proof] The server also has the ability to receive

Guess you like

Origin blog.csdn.net/weixin_45944495/article/details/130716162