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: