TCP three-way handshake and four waved Wireshark packet capture view

TCP three-way handshake to establish a connection

TCP three-way handshake

Server side simulation

Insert picture description here

Client simulation

# 创建TCP套接字
tcp_client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 客户端连接服务端
tcp_client_socket.connect(("192.168.241.1", 8080))

Wireshark filters tcp ports

tcp.port == 8080

Insert picture description here

First handshake

The client sends a SYN signal to the server
First handshake

Second handshake

The server sends a (SYN, ACK) signal from the client
Second handshake

Third handshake

The client sends an ACK signal to the server
Third handshake

TCP waved four times to close the connection

TCP waved four times
The picture is forwarded from TCP's three-way handshake and four waved hands. Understanding and interview questions (very comprehensive) by青柚_

The client actively closes the connection

tcp_client_socket.close()

TCP client closes the connection

Wave for the first time

Wave for the first time

Second wave

Second wave

Third wave

Third wave

Fourth wave

Fourth wave

Guess you like

Origin blog.csdn.net/u010684603/article/details/107924594