TCP protocol three handshake, four waves

Source: Internet
Author: User

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/F2/wKioL1dFX-CQ6KS0AAGDXqxE7S8065.png "title=" Tcp.png "alt=" Wkiol1dfx-cq6ks0aagdxqxe7s8065.png "/>

    • Three-time Handshake connection Establishment phase

1, the client sends the request connection message (SYN=1,SEQ=CLIENT_ISN), the syn=1 indicates the request connection, the SEQ serial number randomly generates

2, the service side receives the request, replies the ACK message, the ACK is the source Seq=client_isc +1, in order to reply to the client to know own request received the reply

3, the client Reply ACK message confirmation establishes the connection, the ACK message is the service side Seq=server_isc +1


    • Four waves (disconnection process)

      1, assume that the disconnection process by the client, then the client sends FIN message, meaning "My clinet client no data to send to you, I want to disconnect", the status becomes (FIN_WAIT1) the application will not immediately close the socket, if there is no data passed can continue to pass

      2, the service side received fin message, send an ACK, said "Your request I know, but I'm not ready, please wait for my message"

      At this point the server state changes to (CLOSE_WAIT), the client receives a status of (Fin_wait1), and the server continues to transmit data

      3, such as service end is busy, will send fin message to the client, said "I am too busy, can be disconnected" status changed to (Last_ack)

      4, the client received the disconnection fin message, will know to shut down the network, but he still does not believe the network, will send an ACK again to the server, the service side will know can be disconnected, and then close the connection, and the client is waiting for 2MSL (life cycle) about 1~ If you do not receive a response after 4 minutes, you will be actively shutting down the socket to close the connection.

TCP protocol three handshake, four waves

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.