Netstat an

netstat -an


Netstat (NETwork STATistics) is a command line tool that provides network information about your activity. If used on a local computer, netstat will display all activity for that one machine, however; if its a network server then netstat will display all activity for all machines connected onto the network.[1]

Active Internet connections (servers and established)
Proto Local Address Foreign Address State
TCP localhost:48898 bubba:0 LISTENING
TCP bubba:6543 SYN_SENT
UDP *:*
UDP [::]:134 *:*

  • Protocol: whatever protocol is being used. Its either TCP which is connection oriented and once a connection is established, data can be sent bidirectional. UDP is a simpler, connection-less Internet protocol. Multiple messages are sent as packets in chunks using UDP.[2]
  • Local Address: is the local host machine name or host IP and port number
  • Foreign Address: is the remote machine name or remote IP and the port number
  • State: either established (meaning currently transmitting data) or time_wait (meaning a connection was made but not currently transmitting)

Simply open a command shell and type netstat -an.

Socket States

The possible socket states are as follows:

  • 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: The socket is closed, and the connection is shutting down.
  • FIN_WAIT2: Connection is closed, and the socket is waiting for a shutdown from the remote end.
  • TIME_WAIT: The socket is waiting after close to handle packets still in the network.
  • CLOSED: The socket is not being used.
  • CLOSE_WAIT: The remote end has shut down, and the socket is closed.
  • LAST_ACK: 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.


  1. Openmaniak. Netstat. 21 Aug 2009.
  2. Differn. TCP vs. UDP.