9)、TIME_WAIT:在主动关闭端接收到FIN后,TCP 就发送ACK包,并进入TIME-WAIT状态。/* The socket is waiting after close to handle packets still in the network.等待足够的时间以确保远程TCP接收到连接中断请求的确认 */
10)、CLOSING: 比较少见。/* Both sockets are shut down but we still don’t have all our data sent. 等待远程TCP对连接中断的确认 */
11)、CLOSED: 被动关闭端在接受到ACK包后,就进入了closed的状态。连接结束。/* The socket is not being used. 没有任何连接状态 */
12)、UNKNOWN: 未知的Socket状态。/* The state of the socket is unknown. */
SYN: (同步序列编号,Synchronize Sequence Numbers)该标志仅在三次握手建立TCP连接时有效。表示一个新的TCP连接请求。
ACK: (确认编号,Acknowledgement Number)是对TCP请求的确认标志,同时提示对端系统已经成功接收所有数据。
FIN: (结束标志,FINish)用来结束一个TCP回话。但对应端口仍处于开放状态,准备接收后续数据。
PS: 在windows下有个小工具挺好的,TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections.见 ; 当然如果要详细分析数据包,可选用sniffer、Wireshark等更强大的工具。
参考资料:
系统连接状态篇:
1.查看TCP连接状态
netstat -nat |awk ‘{print $6}’|sort|uniq -c|sort -rn
netstat -n | awk ‘/^tcp/ {++S〔$NF〕};END {for(a in S) print a, S〔a〕}’ 或
netstat -n | awk ‘/^tcp/ {++state〔$NF〕}; END {for(key in state) print key,”\t”,state〔key〕}’
netstat -n | awk ‘/^tcp/ {++arr〔$NF〕};END {for(k in arr) print k,”\t”,arr〔k〕}’
netstat -n |awk ‘/^tcp/ {print $NF}’|sort|uniq -c|sort -rn
netstat -ant | awk ‘{print $NF}’ | grep -v ‘〔a-z〕‘ | sort | uniq -c
netstat -anlp|grep 80|grep tcp|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq -c|sort -nr|head -n20
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/jisuanjixue/article-69869-3.html
找骂