HTTP protocol three handshake and four waves

Source: Internet
Author: User

TCP is the host to the host Layer Transmission Control Protocol, providing a reliable connection service, with three handshake confirmation to establish a connection:

Bit code is the TCP flag bit, there are 6 kinds of indicators: SYN (Synchronous online) ACK (acknowledgement confirmed) PSH (push transfer) FIN (finish) RST (reset reset) URG (Urgent emergency)

Sequence Number (ordinal number) acknowledge (confirmation)


In the TCP/IP protocol, the TCP protocol provides a reliable connection service, and a three-time handshake is used to establish a connection.


First handshake: When the connection is established, the client sends the SYN packet (SYN=J) to the server and enters the Syn_send state, waiting for the server to confirm;

Second handshake: The server received the SYN packet, must confirm the customer's SYN (ACK=J+1), but also send a SYN packet (syn=k), that is Syn+ack packet, at this time the server into the SYN_RECV state;

Third handshake: The client receives the server Syn+ack packet, sends the confirmation packet ack (ACK=K+1) to the server, this packet sends completes, the client and the server enters established state, completes three times handshake. Completes three handshake, the client and the server begin to transmit the data.


Four times waving:

First wave: Client A sends a fin. To turn off client A to Server B data transfer

Second wave: Server B receives this fin. It sends back an ACK, confirming the ordinal number of the received ordinal number +1. Like Syn, a fin will occupy an ordinal

Third Wave: Server B Closes the connection to client A and sends a fin to client a

Fourth wave: Client A sends back ACK message confirmation, and the confirmation number is set to the serial number plus 1


Attached: network protocol hierarchy diagram


Encapsulation of TCP/IP packets:



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.