TCP session control

A TCP session consists of 3 stages which make it connection-oriented and reliable protocol:

Session Starting

Before a web server can attend to the requests made by a client, TCP uses a 3-way handshake to establish a session between the web server and the web client.

STEP 1

The client sends a single SYN packet(synchronize) to the server. The purpose of this is to ask the server if it is available for connecting.

STEP 2

The server sends a single SYN/ACK packet(acknowledge). This step tells the client that the server is available to talk and wants a message.

STEP 3

The client sends a single ACK packet to the server. This step is the client telling the server: “ok, let’s talk”.

Data Transmission

Now that the connection is established, the data can be transmitted. TCP also ensures that the data packets are successfully transmitted and reassembled in the correct order at the receiver side.

Session Ending

There is a 4-step procedure before the session is terminated.

STEP 1

The server sends the client a FIN packet which means “I am done, can you hear me?”

STEP 2

The receiver sends an ACK packet stating “Yes, I can hear you”.

STEP 3

When the client is done downloading the webpage, it sends a FIN packet to the server saying “I am done, can you hear me?”

STEP 4

The server responds with a final ACK, after which the session can be successfully closed.

--

--

This series of posts is an ongoing effort to lay strong foundations of Cyber Security

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store