TCP connection and release process

 TCP connection and release process

Three-way handshake process

1) A host sends a TCP connection request packet to the host B, where the initial sequence number comprises seq (A) = x host A. (Wherein the packet synchronization flag bit SYN = 1, ACK = 0, indicates that this data is a TCP connection request packet; sequence number seq = x, indicates that the first data byte sequence number when the transmission data is x);

2) After the host B receives the request, it sends back the connection acknowledgment packet. (Wherein acknowledgment segments, flag SYN = 1, ACK = 1, indicates that this is a TCP connection response data packet, and comprising an initial sequence number seq host B (B) = y, and the host B to host A the initial sequence number acknowledgment number ack (B) = seq (a) + 1 = x + 1)

3) Third, the host A receives the acknowledgment message from the host B, the need to confirm that a transmission sequence number seq (A) = x + 1; acknowledgment number ack (A) = y + 1 is reported Wen;

Four waving process

Assume that the host of the client A, B is a host server, the TCP connection release procedure is as follows: 
1) the client closes the connection to the server: a first client A sends the FIN, for closing the client to the data transmission server, and then wait confirm the server. Wherein the termination flag FIN = 1, the sequence number seq = u. 
2) server receives the FIN, it sends back an ACK, acknowledgment number is a sequence number received ack plus 1. 
3) Close the server connected to the client: a FIN is sent to the client. 

4) After the client receives the FIN segment, and sends back an ACK acknowledgment message, and to receive acknowledgment number seq number plus one. First off will be the one to perform active close, while the other performs a passive close.

 

Guess you like

Origin www.cnblogs.com/xiangpeng/p/11030225.html