TCP/IP note 3. transport Layer (4) -- TCP Link Management and TCP state machine 1. establish A three-way handshake (1) tcp of a sends A connection request packet segment to B. Set the synchronous bit SYN in the header to 1, and select the serial number x, indicates that the sequence number of the First Data byte during data transmission is x. (2) After B's TCP receives the connection request packet segment, if agreed, it will be sent back for confirmation. (3) B should set SYN to 1 in the validation packet segment, its confirmation number should be x + 1, and also select the serial number y for itself. (4) After receiving the packet segment, A shall confirm with B, and its confirmation number shall be y + 1. (5) A's TCP notifies the upper-layer application process that the connection has been established. (6) When TCP of host B running the server process receives confirmation from host A, it also notifies its upper-layer application process that the connection has been established. 2. disconnect 2.1 semi-close: Client --> Server has no data, ACK = u + 1Server --> Client has data, Seq = v + t2.2 Time Wait waits for 2MSL (Max Segment Life Time) cause: (1) ensure that the last ACK arrives at B from A (2) Prevent "lost" packets from being received by the Server and establish A connection request. The connection from A to B is released, and the connection is semi-closed. It is equivalent to A saying to B: "I have no data to send. But if you still send data, I still receive it ." 3. TCP State Machine