TPC 三次握手过程
A -> SYN -> B
A <- SYN,ACK <- B
A -> ACK -> B
A 发 SYN 包给B:A(LISTEN -> SYN_SENT) B 收到 SYN 包: B (LISTEN -> SYN_REVD) B 发 SYN,ACK 包给A,A收到包: A (SYN_SENT -> ESTABLISHED) A 发 ACK 包给B,B收到包:B(SYN_SENT -> ESTABLISHED)
TPC 四次分手过程
A -> FIN -> B
B -> ACK -> A
B -> FIN,ACK -> A
A -> ACK -> B
A 发 FIN 包给B:A(ESTABLISHED -> FIN_WAIT_1) B 收到 ACK 包: B (ESTABLISHED -> CLOSE_WAIT) B 发 ACK 包给A,A收到包: A (FIN_WAIT_1 -> FIN_WAIT_1) B 发 FIN,ACK 包给A: B (CLOSE_WAIT -> CLOSED) A 收到FIN,ACK 包: A (FIN_WAIT_1 -> TIME_WAIT) A 发 ACK 包给B,B收到包:B(LAST_ACK -> CLOSED)
TCP Close是因为服务端有个关闭的过程,所以在收到包后会先应答一个ACK,等应用程序处理结束后再发一个 FIN,ACK 包。
MySQL 索引优化: