TCP Working: 3-Way Handshake & Reliable Communication
Introduction
TCP (Transmission Control Protocol) is a reliable communication protocol. Who send data from one computer to another computer. When we are open website or download the file or send email, TCP is ensure then return ordered, complete form and without loss data. TCP is first of all establish connection between sender and receiver. after that break data small pieces then send data packets. And return confirmation that the data has been received.
What is TCP and why it is needed ?
TCP stands for Transmission Control Protocol. It is reliable communication protocol who transfer the data from one computer to another computer. when we are open website, send email, or download the file then we are mostly use TCP protocol. It first of all create connection after that sent small data packets and it will do ensure everything packets reach correct order and without loss any packets. if any data packets loss during send data then TCP resend this packets. TCP is slow but trustworthy.
It is needed because sometimes we are need to send send data secure and with accuracy and received confirmation message that has been received data. therefore need TCP protocol because it is very important.
Features of TCP :
Reliable protocol.
Create connection.
Maintain the data order.
Resend lost data.
It provide secure and accurate communication.
It use in web, email, and file transfer.
Problem TCP is designed to solve :
TCP is a Protocol. It is provide security, best connection, accuracy, data sent confirmation and provide ordered and error free data. TCP mainly use web browsing, email, file transfer, and use in secure communication.
Key Points :
TCP = Reliable transport protocol for the internet
Data safe and proper send.
Data maintain order.
Lost packets return again.
Connection Oriented protocol.
Error checking and provide flow control .
What is the TCP 3 way handshake :
TCP work 3-way handshake through. In 3-way handshake follow the 3 steps SYNC , SYNC-ACK, and ACK. First of all client send send server SYNC(synchronize). after that server send response in SYNC-ACK(synchronize-acknowledge) and finally client send to server ACK(acknowledge).
In This process both side known the connection is ready and both side can data send and receive securely. This process important are reliability and sequence numbering.
Step-by-step working of SYNC, SYNC-ACK, AND ACK :
Step of working SYNC, SYNC-ACK and ACK :
SYNC
Client send SYNC packets to server.
SYNC-ACK
Server send SYNC-ACK in response to client.
ACK
Client receive SYNC-ACK after that response ACK.
How data transfer work in TCP :
In TCP data transfer process is reliable, ordered and error-checked. TCP after that connection establish (via 3-way handshake), break segments of client and server data then send data. Each segments contain sequence number. which can correct order reassemble receiver data. Receiver send ACK after that each segment receiver. which inform send then data send securely. If any segment loss or corrupt data then TCP doing retransmission. This way TCP ensure, reliable and accurate data transmit.
Points transfer Data :
Data Segmentation.
Sending Data.
Acknowledgment (ACK).
Flow Control (Windowing).
Error Checking.
Ordered Delivery.
Connection Termination.
How TCP ensures reliability, ordered, and correctness :
How TCP ensure reliability ?
Acknowledgement (ACK) System :
Receiver send ACK each received segment. If ACK does not found then sender send data again.
Retransmission :
If packets are lost or corrupted then TCP resend data automatically.
Timeout Mechanism :
If ACK is not coming at fix time Then TCP understand packets are lost.
How TCP maintain Order ?
Sequence Numbers :
Each TCP segment contain sequence number.
100 → 200 → 300 → 400
Reassemble at Receiver Side :
If packets come in the wrong order 300 → 100 → 200 then TCP rearrange order.
Out-of-Order Handling
TCP Hold the data while missing packets are not coming.
How TCP check correctness ?
Checksum
Error Detection
Reject + Retransmit
How a TCP Connection is Closed ?
When TCP complete data transfer then close connection. It use process and step after that finally close the connection. Therefore TCP use 4-way Termination process. Which exchange FIN and ACK packets. First of all side close connection this side send fin and another side send ACK after that send his fin and finally first side his ACK send and close fully connection. This process ensure remaining data does not loss and both side are disconnect.