Examples of TCP and UDP in Real Life
Today we will see the Real-Life Examples of TCP and UDP in Computer Networks
Before looking at the Real-Life Examples of TCP and UDP, Let’s see
Attention reader! Don’t stop learning now. Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.
Learn all GATE CS concepts with Free Live Classes on our youtube channel.
What is Computer Network?
A Computer Network is a set of devices (Nodes) that are connected to each other by communication links to share digital information.
The communication links can either be wireless medium or wired medium. In present times, it is impossible to imagine a world without a computer network. From chatting with a friend to making video calls, everything is possible due to the presence of a Computer Network
Computer Network is broadly divided into 3 types.
They are as follows :
- Local Area Network (LAN) –
It is a privately owned network, which usually includes Office, Building, or Campus. Speed Ranges from 100 – 1000Mbps
- Wide Area Network(WAN) –
It involves transmitting the data over large geographic areas such as the country, the continent, or even the whole world.
- Metropolitan Area Network(MAN) –
It involves transmitting the data in and around a city or a town, hence the name Metropolitan Area Network. Its size ranges between that of LAN and WAN.
Network Model :
- A network is an amalgamation of Hardware and Software.
- The Hardware part of the network consists of physical devices such as a switch, hub, and router which are responsible for the transmission of data signals from one network to another
- The Software part consists of protocols(rules) that are required for the proper functioning of the network
- Hence based on the above points, the Network Model is divided into two types
1. OSI Reference Model
2. TCP/IP Reference Model
OSI Reference Model :
The Open Systems Interconnection model (OSI Model) was first introduced in the late 1970s. It is a reference model for designing a network architecture that is robust and flexible. It is a universally accepted model which describes the communication of various applications over the internet.
The OSI Model is divided into 7 layers :
- In order to reduce the design complexity, networks are organized as stacks of layers and levels.
- Each layer has its own set of functions which aids in the successful transfer of data
- Each layer passes the data to the layer immediately below or above it.
The Layers are as follows :
- Application Layer –
It consists of application layer protocol that allows network applications to work correctly in the network
- Presentation Layer –
It receives the data from the application layer and is responsible for Translation, Data Compression, and Encryption/Decryption of the data
- Session Layer –
It is responsible for setting up and managing connections. Its functions include Authentication, Authorization, and Session Restoration.
- Transport Layer –
It receives the data from the Session Layer. It is responsible for the delivery of a message from one process to another. It controls the reliability of communication through flow control, error control, and segmentation. It has two protocols namely TCP and UDP.
- Network Layer –
It is responsible for the transmission of data segments from one computer to another located in different networks
- Data Link Layer –
Responsible for moving frames from one hop to another.
- Physical Layer –
It is responsible for converting the binary bits into signals and transmitting over local media
TCP/IP Reference Model :
The layers in the TCP/IP protocol suite do not exactly match those in the OSI model The original TCP/IP protocol suite was defined as having four layers host to network internet transport and application. TCP/IP Reference Model is the practical implementation of the theoretical OSI Model
Transport Layer :
The layer below the Session Layer is called the Transport Layer. The Data in this layer is called a segment. It is responsible for the delivery of a message from one process to another. It is also responsible for reliable communication through flow control, error control, and segmentation. Some of the most important protocols are Transmission Control Protocol (TCP) and User Datagram Protocol(UDP). It does two types of Transmission i.e Connection-Oriented Transmission and Connectionless Transmission which are carried out by TCP and UDP respectively.
Some of the Responsibilities of Transport Layer are as Follows :
- End to End delivery
- Error Control
- Flow Control
- Multiplexing and Demultiplexing
Transmission Control Protocol (TCP) :
It is a connection-oriented protocol that is used for the reliable transfer of data from one process to another process. It takes the help of the Port numbers for transmission. It uses flow control and error control mechanisms at the transport level. There are three phases in which TCP transmits the data between the sender and receiver which is as follows:
- Connection Establishment –
It takes the help of 3 way handshaking mechanism for Connection Establishment which involves the exchange of SYN, ACK, and window size
- Data transfer –
In this step, the transmission of data occurs
- Connection termination –
Here the transmission of data gets terminated by sending a FIN packet to the receiver.
Services offered by the TCP are as follows :
- Process to Process or end to end Communication using Port numbers
- Transmits the data as a stream of bytes from source to destination
- It groups the data that comes from the application into packets called Segments. It also adds a header to each data segment and sends it to the network layer
- It offers Full Duplex communications
- Reliable Service: TCP uses an acknowledgment mechanism which makes it reliable
- It offers Flow control, Error control, and Congestion control too.
- Flow Control
- Error Control
- Congestion Control
- Process to Process Communication
- Inorder delivery of data segments
- The data segments don’t get transmitted immediately
- More overhead(20-60Bytes)
- It has a large TCP Header
User Datagram Protocol (UDP) :
It is a transport layer protocol. It is an unreliable and connectionless protocol. It is much faster, simpler, and efficient than TCP. However, it doesn’t check errors due to which Bandwidth is saved. It is widely used in real-time services like videogame, voice, or video communication
The packets sent by the UDP are called user datagrams.
Services offered by the TCP are as follows :
- Process to Process port to port transmission of segments
- Connectionless and minimum overhead Protocol
- Fast and simple transmission
- No flow and error control, applications using UDP services are responsible for providing them
- UDP encapsulates and decapsulates the messages.
- The packet created by UDP is relatively smaller than that of TCP(UDP Header: 8 bytes)
- Connectionless Transmission
- It is Faster, Simpler and Efficient
- There is no guarantee that the sender will receive the data
- Lack of proper Errochecking mechanisms
- The lost packets will not be retransmitted
- There is a possibility of receiving out of order packets
Real-Life Examples of TCP :
- Text Communication –
We all are aware of the importance of Text Communication in the present times. Any discrepancy in texting between sender and receiver cannot be tolerated. Hence TCP is used in Text Communication due to its reliable transmission, error control, and in order receiving of the data.
Example : Whatsapp, Instagram, Google Chat,iMessage.
- Transfer of files or FTP –
TCP is used in File transfer when we cannot tolerate the loss of data and receiving the data incorrect order is of utmost importance. FTP uses two TCP connections i.e control connection and data connection.
Control Connection : FTP sends information like user identification and passwords.
Data Connection: In this connection, files are sent over the network.
Ex : FileZilla Client and Server
- HyperText Transfer Protocol (HTTP) –
It is used to access the data present on the World Wide Web. It uses TCP protocol for accessing the web pages present on the internet due to the fact that TCP provides inorder data, error control and flow control, and retransmission of data segments.
- Simple Mail Transfer Protocol(SMTP)
It is an application layer protocol that is used to send Emails from one system to another. SMTP uses the services of TCP to start a connection with the SMTP server. Once the SMTP server accepts the connection request, it allows the sender to send the mails.
Ex: Yahoo, Gmail, Outlook, etc
Real-Life Examples of UDP :
- Online Games –
Most of the online games we play use the services of User Datagram Protocol. Since any amount of delay cannot be tolerated in online games UDP is widely used over TCP which is quite slower. UDP doesn’t retransmit the lost data and is a connectionless protocol due to which it is much faster.
Ex : All online games
- Video Conferencing –
Video Conferencing apps like Skype, Gmeet, Zoom, all use the services of UDP due to the fact that they are real-time applications and any delay in receiving the data cannot be tolerated.
Ex: Skype, Google Meet, zoom, and Facetime.
- Voice Over IP(VoIP) –
It is similar to Video Conferencing, where apps like Viber, Whatsapp, Google Hangouts use UDP for converting our voice to digital data and transmit it over the network, hence the name VoIP.
Ex : Viber, Whatsapp Voice calling, Wi-Fi calling.
- Domain Name System(DNS) –
It is a service used for mapping domain names to their corresponding IP address. It is used by the application layer. It can also be looked at as a distributed DataBase that has a hierarchical name Server. DNS uses UDP for fetching the corresponding IP address due to the following reasons:
a) UDP is much faster than TCP. After all, speed matters a lot when loading a webpage
b) DNS requests are typically small requests and can be accommodated inside UDP segments(Header).
c) Even though UDP is unreliable, it can be achieved in the application layer too
Hence, these were the Real-Life Examples of TCP and UDP.