TCP three-time handshake and four-time wave

Source: Internet
Author: User
Tags ack


(1) SYN (synchronous set up online)

(2) ACK (Acknowledgement confirmation)

(3) PSH (push transfer)

(4) FIN (end of finish)

一、三次 handshake

(1) First handshake: The client sends the SYN packet (SYN=X) to the server and enters the syn_send state , waiting for the server to confirm;

(2) The second handshake: the server receives the SYN packet, must confirm the customer's SYN (ACK=X+1), simultaneously also sends a SYN packet (syn=y), namely the Syn+ack packet , at this time the server enters the syn_recv state ;

(3) The third handshake: the client receives the server's Syn+ack packet, sends the acknowledgment packet ack(ack=y+1) to the server, and after the packet is sent, the client and server enter the established state and complete three handshake.

The packets delivered during the handshake do not contain data , and after the three handshake is completed, the client and server formally begin transmitting the data. Ideally, once a TCP connection is established, the TCP connection will persist until either side of the communication is actively shutting down the connection.

二、四次 waved.

(1) The first handshake: the active shut-off party sends a fin packet to close the active side of the data transfer, (before the fin packet sent out data, if not received ACK acknowledgement message, the active side will still resend the data) but at this time the active closed side can also accept the data.

(2) Second wave: The passive closing party receives the fin packet, sends an ACK packet to the other party, confirms that the serial number is received sequence number +1, (same as Syn, a fin occupies a serial number).

(3) Third wave: The passive shut-off party sends a FIN packet to turn off the passive shutdown to the active shut-off side of the data transfer. (data transfer off)

(4) Wave for the fourth time: the active closing party receives FIN, sends an ACK packet to the passive closing party, confirms the serial number to receive the serial number +1, at this point, completes four times the wave.

TCP three-time handshake and four-time wave

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: 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.