TCP/IP Connection Establishment

This page shows the process for establishing a TCP/IP connection. In this example, we assume a client computer is contacting a server to send it some information.

  1. Client sends a packet with the SYN bit set and a sequence number of N.
  2. Server sends a packet with an ACK number of N+1, the SYN bit set and a sequence number of X.
  3. The client sends a packet with an ACK number of X+1 and the connection is established.
  4. The client sends the data.

TCP/IP Connection Termination

  1. One computer sends a FIN packet to the other computer including an ACK for the last data received (N).
  2. The other computer sends an ACK number of N+1
  3. It also sends a FIN with the sequence number of X.
  4. The originating computer sends a packet with an ACK number of N+1. The connection is closed.

Another way to close the connection is for one computer to send a packet with the RST (reset) bit set which will tell the other computer to immediately terminate the connection.