客户端主动关闭,timed_wait:
node2:/root/test#cat t15.py
import socket
import struct
import time
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.connect(("192.168.137.2",8080))
print s.getsockname()
print s.getpeername()
time.sleep(20)
s.close()
node2:/root/test#python t15.py
('192.168.137.3', 52028)
('192.168.137.2', 8080)
客户端time_wait:
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 ESTABLISHED
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 ESTABLISHED
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 ESTABLISHED
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:52028 192.168.137.2:8080 TIME_WAIT
服务端干干净净:
tcp 0 0 192.168.137.2:8080 192.168.137.3:52028 ESTABLISHED
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 192.168.137.3:52028 ESTABLISHED
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN
tcp 0 0 192.168.137.2:8080 0.0.0.0:* LISTEN