TCP 3-Way handshake
networking system infrastructure is built using OSI modal. OSI modal contains 7 layers.
The application layer is top of the transport layer so we must consider TCP/IP protocols. TCP mean Transmission Control Protocol. In this article, we are talking about TCP.
Structure of the TCP header.
The TCP header contains two ports called Source Port and Destination Port. Source Port holds the port address of the application (sender) and Destination Port (receiver) holds the port address of the application in the host(server). Those two ports behave as windows in a room. Those windows have their own sizes. Those sizes are measured in bytes. Also, there are several flags called URG, ACK, PSH, RST, and FIN. They are used to control connection establishment.
The way TCP helps to communicate.
SYN — At the very first time, the client sends the SYN flag with Sequence Number. (SEQ shows as 0 at the very first time, but in reality, It is a Random Number)
SYN + ACK — As per response, the Server sends the SYN and ACK signals with the Sequence Number.
ACK — As per response to the SYN signal, the client sends the ACK signal with the Sequence Number to the server.\
Practical examples.
First, run the server and next run the client file. Initially, the client sends the Syn packet to the server. Then the following result will be received. In this Seq=0 SYN flag set to the 1.
Next, the server received the Syn packet. So, the server responds to the client with Syn and Ack. Both SYN and ACK flags are set to 1. As these, acknowledge number is 1 because the server informs the client that I received Seq=0 so I hope Syn=1 from you next time.
For the server sync accoutrements server and client sending like these.
For more information.
https://www.youtube.com/watch?v=UpUd5zEUUgI&ab_channel=KrishDinesh