23.2 C

The TCP connection on Linux

The following post aims to explain the status messages offered by tools such as netstat or ss, in the current connections of the GNU/Linux system. However, the TCP connection should be considered.

A TCP connection establishes connections using the three-way handshake protocol. Also to establish a connection one side, it passively waits for the incoming connection by running the LISTEN and ACCEPT primitives and specifying a certain origin or no one in particular.

While on the other side, it runs a CONNECT primitive specifying the IP address and port to which you want to connect. Similarly the maximum size of TCP segment that is willing to accept and optionally some user data. The CONNECT primitive sends a TCP segment with the SYN bit on and the ACK bit off, and waits for a response.

States in the TCP connection

On the other hand, a TCP connection is an operating system administrator, in this case, it would be GNU/Linux.

- Advertisement -

By means of a resource that represents the local endpoint, during the life of the TCP connection. The local endpoint experiences several states, which are the following.

  • ESTABLISHED: The socket has an established connection.
  • SYN_SENT: The socket actively attempts to establish a connection.
  • SYN_RECV: Received a request for network connection.
  • FIN_WAIT1: The bag is closed and the connection closes.
  • FIN_WAIT2: The connection closes and the socket is waiting for a shutdown of the remote end.
  • TIME_WAIT: The socket waits after closing to handle the various packets that are still on the network.
  • CLOSE: You are not using the plug.
  • CLOSE_WAIT: The remote connection has ended, waiting for the socket to close.
  • LAST_ACK: The remote connection has ended and the socket closes, waiting for recognition.
  • CLOSING: Both sockets are off, but not all data has been sent yet.
  • UNKNOWN: The status of the socket is unknown.


The TCP connection is the establishment of a connection of a multi-step recognition process. Before entering the data transfer phase.

Also, once the data transmission is complete, the termination of the connection closes the connection and releases all the resources allocated.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article