>Three-Way Handshake (TCP/IP)

I previously blogged about the OSI model, which characterizes computing functions into a universal set of rules and requirements in order to support interoperability between different products and software.

TCP (Transmission Control Protocol) is another rule used in computer networking. The protocol is similar to the OSI model and consists of four layers:

  • Application
  • Transport
  • Internet
  • Network Interface

Some may say the TCP/IP protocol is basically a summarized version of the OSI model.

Information is added to each layer of the TCP model as the packet traverses it (encapsulation). The reverse of this process is called de-encapsulation.

TCP is connection-based, which means it must establish a connection between both client and a machine (server) before data is sent. This means TCP guarantees that any data sent will be received on the other end in a process known as the “three-way handshake.”

The Three-Way Handshake

The three-way handshake is the term used for the process to establish a connection between client and server:

  1. SYN – A SYN message is the initial packet sent by a client during the handshake. This packet is used to initiate a connection and synchronize the two devices together.
  2. SYN/ACK – This packet is sent by the receiving device (server) to acknowledge the synchronization attempt from the client.
  3. ACK – The acknowledgement packet can be used by either the client or server to acknowledge that a series of messages/packets have been successfully received.

After the connection is established, the machines can then send data to each other via the DATA message.

Closing the TCP Connection

First, TCP will close a connection once a device has determined that the other device has successfully received all of the data.

To initiate the closure of a TCP connection, the device will send a FIN packet to the other device. Of course, with TCP, the other device will also have to acknowledge (ACK) this packet.

Leave a Comment