TCP is the layer 4 networking protocol of the OSI model, TCP is responsible for the networking capabilities, both TCP and UDP are placed in the LAYER 4 OSI MODEL, TCP sends packets across the internet and makes sure that the packets are transferred securely, consistently and efficiently.
TCP connection is established by 2 servers and once the TCP session is established, DATA packets can be sent across TCP.
- TCP Establishes the connection
- TCP manages the established connection
- TCP is Terminated when the data transfer is completed.
TCP leverages the THREE WAY HANDSHAKE to establish a secret and reliable connection
CLIENT <——–3 WAY HANDSHAKE————> SERVER
TCP is a TRANSPORT LAYER PROTOCOL.
TCP Provides the following set of services:
-> High-quality connection management
-> Connection/data reliability and data integrity is kept intact
-> Effective Data Flow Control.
-> Effective congestion control.
TCP is leveraged in TEXT TRANSMISSION of TEXT COMMUNICATION, due to high reliability and complete data transfer guarantee, TCP is not leveraged for Voip / VIDEO / AUDIO stream as the bandwidth usage of media data is very high as compared to TEXT DATA.
TCP is chatty so streaming media data will not be cost-effective and will introduce high latency in the real-time streaming services.
TCP FLAGS -> SYN FLAG / ACK FLAG / FIN FLAG
Data is sent from one server to another server via TCP / IP protocols, both the IP and TCP are diagrammatically visualized.
IP PACKET
ip header | Ip data
(32 bit) ( 4 bytes)
TCP Segment
Source port | Destination port | Sequence number | Acknowledgement number | Offset / reserved | Window size | Checksum | Unsent pointer | Option / padding | DATA
Just like IP, the TCP segment contains the TC header
DATA: The TCP header is bulkier than the UDP header, and the TCP DATAGRAM is more meta-data rich than UDP DATAGRAM, A lot of meta-data is stored above the data layer to ensure safe, reliable, and efficient communication/transport paradigm over the web.
Common header fields in UDP and TCP are :
- Source port number
- Destination Port Number
- Checksum
TCP is a stateful protocol and the UDP is a stateless protocol.
These are the basic steps for establishing TCP CONNECTION:
1) ESTABLISH TCP CONNECTIONS | 2) DATA PACKET SENT VIA TCP LAYER | 3) CONNECTION CLOSED ONCE DATA PACKET SENT |
TCP is an old protocol, it was invented in the year 1974, it was based on the transmission control Program and this is where it got its name TRANSPORT CONTROL PROTOCOL, the protocol to control the transmission of data in layer 4 of OSI MODEL.
- TCP ensures a reliable data stream by abiding by 3-way handshake, re-transmission, and error detection.
- TCP is stateful, unlike UDP which is stateless.
- TCP provides a connection full datagram.
- TCP provides (host to host) connectivity at (transport layer -layer4)
- TCP adapts to segment numbering systems and strong connections which are sticky and provide higher data communication efficiency.
KEY DIFFERENCE BETWEEN TCP and UDP:
TCP (Transmission control protocol)
- State-based communication
- Stateful protocol (state is maintained)
- Higher data overhead.
- 3-way handshake
- Higher chattiness
UDP (User datagram protocol)
- User datagram protocol
- VVOIP, audio/video data transfer
- Stateless protocol (stat is not maintained)
- Lower data overhead
- One directional
- Lower chattiness
Both TCP and UDP are layer 4 transport protocols and they both are operated in LAYER 4 of OSI MODEL and hence serve different use cases. Layer 7 clients will needs to Layer 4 protocols to operate.
- FTP CLIENTS
- SSH CLIENTS
- SMTP CLIENTS
- HTTP CLIENTS
- TLS CLIENTS
- SSL CLIENTS
All the above-mentioned clients work over the TCP and UDP layer as layer 4 of the OSI model is used to carry out the transmission control of the data across the web and application infrastructure.
TCP is programmed at the kernel level hence it ensures a standardized efficient and reliable data-transporting protocol. The reliability of TCP connections is way higher than that of UDP connections.
The article above is rendered by integrating outputs of 1 HUMAN AGENT & 3 AI AGENTS, an amalgamation of HGI and AI to serve technology education globally.