用netstat对TCP状态分析
2015-11-30 17:20
405 查看
用netstat对TCP状态分析
--numeric , -n
Show numerical addresses instead of trying to determine symbolic host, port or user names.
-o, --timers
Include information related to networking timers.
-p, --program
Show the PID and name of the program to which each socket belongs.
-l, --listening
Show only listening sockets. (These are omitted by default.)
-a, --all
Show both listening and non-listening (for TCP this means established connections) sockets. With the --interfaces option, show interfaces that are
not marked
The protocol (tcp, udp, raw) used by the socket.
Recv-Q 数据已经在read buffer,但是应用程序还没有调用recv().
单位是字节 The count of bytes not copied by the user program connected to this socket.
Send-Q 在write buffer中, 表示对端没有收到的数据或者说没有发Ack来确认的数据
单位是字节 The count of bytes not acknowledged by the remote host.
Local Address
Address and port number of the local end of the socket. Unless the --numeric (-n) option is specified, the socket address is resolved to its
canonical host name (FQDN), and the port number is translated into the corresponding service name.
Foreign Address
Address and port number of the remote end of the socket. Analogous to "Local Address."
State
The state of the socket. Since there are no states in raw mode and usually no states used in UDP, this column may be left blank. Normally this can
be one of several values:
ESTABLISHED
The socket has an established connection.
SYN_SENT
The socket is actively attempting to establish a connection.
SYN_RECV
A connection request has been received from the network.
FIN_WAIT1
此状态是:“主动关闭方” 主动发送了 FIN 给对端后的状态
The socket is closed, and the connection is shutting down.
FIN_WAIT2
此状态是: “主动关闭方” 主动发送了 FIN 给对端, 并接收到对端的回应的ACK 后的状态
Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT
此状态是: “主动关闭方” 主动发送了 FIN 给对端,并接收到对端的回应的ACK,然后接收到对端 发送的FIN后的状态
The socket is waiting after close to handle packets still in the network.
CLOSED The socket is not being used.
此状态是: “被动关闭方” 接收到了对端先发来的FIN,并发送了ACK ,然后发送FIN后的状态,并接收到了对端的ACK回复的状态
CLOSE_WAIT : The remote end has shut down, waiting for the socket to close.
此状态是: “被动关闭方”接收到了对端先发来的FIN
状态变成CLOSE_WAIT, 此时 要调用close()关闭连接,不然就会有CLOSE_WAIT状态
{::recv()的返回值:
n:These calls return the number of bytes received,
-1:or -1 if an error occurred.
0:The return value will be 0 when the peer has performed an orderly shutdown. }
LAST_ACK
此状态是: “被动关闭方” 接收到了对端先发来的FIN,并发送了Ack ,然后发送FIN后的状态
The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN The socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listening (-l) or
--all (-a) option.
CLOSING
Both sockets are shut down but we still don’t have all our data sent.
UNKNOWN
The state of the socket is unknown.
User
The username or the user id (UID) of the owner of the socket.
PID/Program name
Slash-separated pair of the process id (PID) and process name of the process that owns the socket. --program causes this column to be included.
You will also need superuser privileges to see this information on sockets you don’t own. This identification information is not yet available for
IPX sockets.
Timer
(this needs to be written)
Active UNIX domain Sockets
Proto
The protocol (usually unix) used by the socket.
RefCnt
The reference count (i.e. attached processes via this socket).
Flags
The flags displayed is SO_ACCEPTON (displayed as ACC), SO_WAITDATA (W) or SO_NOSPACE (N). SO_ACCECPTON is used on unconnected sockets if their
corresponding processes are waiting for a connect request. The other flags are not of normal interest.
Type
There are several types of socket access:
SOCK_DGRAM
The socket is used in Datagram (connectionless) mode.
SOCK_STREAM
This is a stream (connection) socket.
SOCK_RAW
The socket is used as a raw socket.
SOCK_RDM
This one serves reliably-delivered messages.
SOCK_SEQPACKET
This is a sequential packet socket.
SOCK_PACKET
Raw interface access socket.
UNKNOWN
Who ever knows what the future will bring us - just fill in here :-)
State
This field will contain one of the following Keywords:
FREE The socket is not allocated
LISTENING
The socket is listening for a connection request. Such sockets are only included in the output if you specify the --listening (-l) or --all
(-a) option.
CONNECTING
The socket is about to establish a connection.
CONNECTED
The socket is connected.
DISCONNECTING
The socket is disconnecting.
(empty)
The socket is not connected to another one.
UNKNOWN
This state should never happen.
PID/Program name
Process ID (PID) and process name of the process that has the socket open. More info available in Active Internet connections section written
above.
--numeric , -n
Show numerical addresses instead of trying to determine symbolic host, port or user names.
-o, --timers
Include information related to networking timers.
-p, --program
Show the PID and name of the program to which each socket belongs.
-l, --listening
Show only listening sockets. (These are omitted by default.)
-a, --all
Show both listening and non-listening (for TCP this means established connections) sockets. With the --interfaces option, show interfaces that are
not marked
The protocol (tcp, udp, raw) used by the socket.
Recv-Q 数据已经在read buffer,但是应用程序还没有调用recv().
单位是字节 The count of bytes not copied by the user program connected to this socket.
Send-Q 在write buffer中, 表示对端没有收到的数据或者说没有发Ack来确认的数据
单位是字节 The count of bytes not acknowledged by the remote host.
Local Address
Address and port number of the local end of the socket. Unless the --numeric (-n) option is specified, the socket address is resolved to its
canonical host name (FQDN), and the port number is translated into the corresponding service name.
Foreign Address
Address and port number of the remote end of the socket. Analogous to "Local Address."
State
The state of the socket. Since there are no states in raw mode and usually no states used in UDP, this column may be left blank. Normally this can
be one of several values:
ESTABLISHED
The socket has an established connection.
SYN_SENT
The socket is actively attempting to establish a connection.
SYN_RECV
A connection request has been received from the network.
FIN_WAIT1
此状态是:“主动关闭方” 主动发送了 FIN 给对端后的状态
The socket is closed, and the connection is shutting down.
FIN_WAIT2
此状态是: “主动关闭方” 主动发送了 FIN 给对端, 并接收到对端的回应的ACK 后的状态
Connection is closed, and the socket is waiting for a shutdown from the remote end.
TIME_WAIT
此状态是: “主动关闭方” 主动发送了 FIN 给对端,并接收到对端的回应的ACK,然后接收到对端 发送的FIN后的状态
The socket is waiting after close to handle packets still in the network.
CLOSED The socket is not being used.
此状态是: “被动关闭方” 接收到了对端先发来的FIN,并发送了ACK ,然后发送FIN后的状态,并接收到了对端的ACK回复的状态
CLOSE_WAIT : The remote end has shut down, waiting for the socket to close.
此状态是: “被动关闭方”接收到了对端先发来的FIN
状态变成CLOSE_WAIT, 此时 要调用close()关闭连接,不然就会有CLOSE_WAIT状态
{::recv()的返回值:
n:These calls return the number of bytes received,
-1:or -1 if an error occurred.
0:The return value will be 0 when the peer has performed an orderly shutdown. }
LAST_ACK
此状态是: “被动关闭方” 接收到了对端先发来的FIN,并发送了Ack ,然后发送FIN后的状态
The remote end has shut down, and the socket is closed. Waiting for acknowledgement.
LISTEN The socket is listening for incoming connections. Such sockets are not included in the output unless you specify the --listening (-l) or
--all (-a) option.
CLOSING
Both sockets are shut down but we still don’t have all our data sent.
UNKNOWN
The state of the socket is unknown.
User
The username or the user id (UID) of the owner of the socket.
PID/Program name
Slash-separated pair of the process id (PID) and process name of the process that owns the socket. --program causes this column to be included.
You will also need superuser privileges to see this information on sockets you don’t own. This identification information is not yet available for
IPX sockets.
Timer
(this needs to be written)
Active UNIX domain Sockets
Proto
The protocol (usually unix) used by the socket.
RefCnt
The reference count (i.e. attached processes via this socket).
Flags
The flags displayed is SO_ACCEPTON (displayed as ACC), SO_WAITDATA (W) or SO_NOSPACE (N). SO_ACCECPTON is used on unconnected sockets if their
corresponding processes are waiting for a connect request. The other flags are not of normal interest.
Type
There are several types of socket access:
SOCK_DGRAM
The socket is used in Datagram (connectionless) mode.
SOCK_STREAM
This is a stream (connection) socket.
SOCK_RAW
The socket is used as a raw socket.
SOCK_RDM
This one serves reliably-delivered messages.
SOCK_SEQPACKET
This is a sequential packet socket.
SOCK_PACKET
Raw interface access socket.
UNKNOWN
Who ever knows what the future will bring us - just fill in here :-)
State
This field will contain one of the following Keywords:
FREE The socket is not allocated
LISTENING
The socket is listening for a connection request. Such sockets are only included in the output if you specify the --listening (-l) or --all
(-a) option.
CONNECTING
The socket is about to establish a connection.
CONNECTED
The socket is connected.
DISCONNECTING
The socket is disconnecting.
(empty)
The socket is not connected to another one.
UNKNOWN
This state should never happen.
PID/Program name
Process ID (PID) and process name of the process that has the socket open. More info available in Active Internet connections section written
above.
相关文章推荐
- 关于http请求和webservice请求的了解?
- java Tcp/Udp区别
- iOS开发网络篇—文件的上传
- iOS开发网络篇—监测网络状态
- tomcat下配置https环境
- 网络爬虫基本原理(二)
- 使用HttpCLient处理HTTP请求
- okhttpclient 文件断点上传
- iOS开发网络篇—发送json数据给服务器以及多值参数
- 网络爬虫基本原理(一)
- iOS开发网络篇—数据缓存
- 网络获取图片
- 定位网络攻击一例
- 卷积神经网络
- spring 4.x下让http请求返回json串
- 图片加载提速--方法一httpcache
- spring 4.x下让http请求返回json串
- Web组件之间存在三种关联关系(转发,重定向,包含)http://ihuangweiwei.iteye.com/blog/1217776
- IOS Swift TableViewCell 加载网络图片后图片高度
- Eclipse下搭建Android环境的网络配置