Source: www.net130.com Date: 2005-03-03
Netstat
Display the TCP connection of the active TCP connection, computer listening port, Ethernet statistics, IP routing table, IPv4 statistics (for IP, ICMP, TCP, and UDP protocol), and IPv6 statistics (for IPv6, ICMPv6, through IPv6 TCP and Through the UDP protocol of IPv6). If you do not use a parameter, NetStat displays the active TCP connection.
grammar
NetStat [-a] [-e] [-n] [-o] [-P protocol] [-r] [-s] [interval]
parameter
-A
Display all active TCP connections and computer listening TCP and UDP ports.
-e
Display Ethernet statistics, such as sending and receiving bytes, number of packets. This parameter can be used in conjunction with -s.
NN
Display the TCP connection of the activity, but only the address and port number are expressed in digital form, but do not attempt to determine the name.
-o
Displays the active TCP connection and includes process ID (PID) of each connection. A PID-based application can be found on the Process tab in the Windows Task Manager. This parameter can be used in conjunction with -a, -n and -p.
-p protocol
Displays the connection of protocol specified by Protocol. In this case, Protocol can be TCP, UDP, TCPv6 or UDPv6. If the parameter displays statistics by the protocol with -s, Protocol can be TCP, UDP, ICMP, IP, TCPv6, UDPv6, ICMPv6 or IPv6.
-S
Display statistics by protocol. By default, statistics for TCP, UDP, ICMP, and IP protocols are displayed. If you have an IPv6 protocol for Windows XP, statistics on the TCP, IPv6, and IPv6 protocols on IPv6 are displayed. The protocol set can be specified using the -p parameter.
-r
Displays the contents of the IP routing table. This parameter is equivalent to the ROUTE PRINT command.
Interval
Re-displays a selected information every interval second. Press CTRL C to stop rescan statistics. If this parameter is omitted, NetStat will only print a selected information.
/?
Display help at the command prompt.
Comment
The parameters used with this command must be prefixed in a consecutive character (-) instead of short oblique line (/).
NetStat provides the following statistics:
Proto
The name of the protocol (TCP or UDP).
Local Address
The IP address of the local computer and the port number being used. If the -n parameter is not specified, the local computer name corresponding to the name of the IP address and the port is displayed. If the port is not established, the port is displayed in an asterisk (*).
Foreign Address
Connect the IP address and port number of the remote computer of the slot. If the -n parameter is not specified, the name corresponding to the IP address and port is displayed. If the port is not established, the port is displayed in an asterisk (*).
(State)
Indicates the status of the TCP connection. Possible status is as follows:
Close_wait
Closed
Established
FIN_WAIT_1
FIN_WAIT_2
Last_ack
Listen
SYN_RECEIVED
SYN_SEND
TIMED_WAIT
For information on TCP connection status, see RFC 793.
This command is only available when an internet protocol (TCP / IP) protocol is installed as components of the network adapter property in the network connection.
example
To display the statistics of Ethernet statistics and all protocols, type the following command:
Netstat -e -s
To display only statistics of TCP and UDP protocols, type the following command:
Netstat -s -p TCP UDP
To display an active TCP connection and process ID every 5 seconds, type the following command:
NBTSTAT -O 5
To display the active TCP connection and process ID in digital form, type the following command:
NBTSTAT-N -O