TCP is a connection-oriented, reliable, and byte-stream-based Transport layer communication protocol. In the simplified computer network OSI model, it completes the functions specified by the layer-4 transport layer. TCP (Transmission Control Protocol) is an industrial standard Protocol set designed for Wide Area Network (WANs. It was developed by research institutions of the ARPANET network. Protocol 1. TCP connection status the TCP connection status is divided into 12 types: ESTABLISHED, SYS_SENT, SYN_RECV, FIN_WAIT1, FIN_WAIT2, TIME_WAIT, CLOSED, CLOSED, LAST_ACK, LISTEN, CLOSEING, and UNKNOWN. In many cases, no 12th types are added. In fact, it also belongs to the TCP connection status. 2. Establish a connection over TCP (three handshakes over TCP) 1. first, the Client sends a request with the syn sign to the Server and waits for the Server's response. 2. after receiving the request from the Client, the Server immediately responds to the response packet with the syn ack flag on the Client side (the state in netfilter has been recorded as ESTABLSHED ). Www.2cto.com 3. After the Client receives a response, it sends an ack package to the Server. At this time, the establishment is complete and normal communication can be performed. The connection status becomes TCP's ESTABLSHED. 3. TCP termination 1. The Client sends an end request packet with the fin flag to the Server. 2. After receiving the request, the Server responds to the response packet with ack from the Client, and then sends the end request packet with fin. 3. After receiving the request, the Client also responds to the response packet with ack. The TCP connection is interrupted.