Basics of Computer Networking
Basics of Computer Networking
Basics of Computer Networking
•
Computer networking is very important in modern technology, enabling the
interconnected systems that power the Internet, business communications, and
everyday digital interactions. Understanding the fundamentals of computer
networking is essential for anyone involved in technology, from enthusiasts to
professionals. This article will explore the basics of computer networking,
including network types, components, protocols, and essential services like the
Domain Name System (DNS).
Computer Networking
Network Devices
Network Topology
The Network Topology is the layout arrangement of the different devices in a
network. Some types of network topologies are:
• Bus Topology: In bus topology all devices are connected to a single central
cable called a bus. Data is sent along this cable and all devices share the same
connection. Simple and cheap to set up but if the main cable fails the whole
network goes down.
• Star Topology: In star topology all devices are connected to a central node
called hub or switch. The hub controls the flow of data between devices. If one
device fails the rest of the network is unaffected. But, if the central hub fails
the whole network stops working.
• Ring Topology: In ring topology devices are connected in a circular loop with
each device connected to two others. Data travels in one direction (or
sometimes both) passing through each device until it reaches its destination.
A failure in one device can affect the whole network.
• Mesh Topology: In mesh topology every device is connected to every other
device in the network. It provides multiple paths for data so if one path fails
another can take over.
• Tree Topology: Tree topology is the combination of star and bus topology.
Tree topology is good for organizing large networks and allows for easy
expansion.
• Hybrid Topology: Hybrid topology is the combination of two or more
different topologies (like star and mesh). It is flexible and can be customized
based on the network’s specific needs.
Network Topology
OSI Model
OSI stands for Open Systems Interconnection. It is a reference model that specifies
standards for communications protocols and also the functionalities of each
layer. The OSI has been developed by the International Organization For
Standardization and it is 7 layer architecture. Each layer of OSI has different
functions and each layer has to follow different protocols. The 7 layers are as
follows:
• Physical Layer
• Data link Layer
• Network Layer
• Transport Layer
• Session Layer
• Presentation Layer
• Application Layer
Network Protocols
A protocol is a set of rules or algorithms which define the way how two entities
can communicate across the network and there exists a different protocol defined
at each layer of the OSI model. A few such protocols are TCP, IP, UDP, ARP, DHCP,
FTP, and so on.
• Transmission Control Protocol/Internet Protocol (TCP/IP): TCP/IP is the
foundational protocol suite of the internet, enabling reliable communication.
TCP Ensures data is delivered reliably and in order and IP routes data packets
to their destination based on IP addresses.
• Hypertext Transfer Protocol (HTTP) and HTTPS: HTTP
and HTTPS protocols used for transmitting web pages. In
HTTP communication is unsecured and in HTTPS secured communication
using SSL/TLS encryption.
• Simple Mail Transfer Protocol (SMTP): SMTP protocol used to send
email. SMTP protocol works with other protocols like POP3 and IMAP for
email retrieval.
• File Transfer Protocol (FTP): FTP protocol used for transferring files
between computers. Includes commands for uploading, downloading, and
managing files on a remote server.
• Dynamic Host Configuration Protocol
(DHCP): DHCP protocol automatically assigns IP addresses to devices on a
network. Reduces manual configuration and IP address conflicts.
• Domain Name System (DNS): DNS Translates human-friendly domain
names into IP addresses. Ensures seamless navigation on the internet.
Unique Identifiers of Network
Hostname: Each device in the network is associated with a unique device name
known as Hostname. Type “hostname” in the command prompt(Administrator
Mode) and press ‘Enter’, this displays the hostname of your machine.
HostName
IP Address (Internet Protocol address): Also known as the Logical Address, the
IP Address is the network address of the system across the network. To identify
each device in the world-wide-web, the Internet Assigned Numbers Authority
(IANA) assigns an IPV4 (Version 4) address as a unique identifier to each device
on the Internet. The length of an IPv4 address is 32 bits, hence, we have 232 IP
addresses available. The length of an IPv6 address is 128 bits.
In Windows Type “ipconfig” in the command prompt and press ‘Enter’, this gives
us the IP address of the device. For Linux, Type “ifconfig” in the terminal and press
‘Enter’ this gives us the IP address of the device.
MAC Address (Media Access Control address): Also known as physical
address, the MAC Address is the unique identifier of each host and is associated
with its NIC (Network Interface Card). A MAC address is assigned to the NIC at
the time of manufacturing. The length of the MAC address is: 12-nibble/ 6 bytes/
48 bits Type “ipconfig/all” in the command prompt and press ‘Enter’, this gives
us the MAC address.
Port: A port can be referred to as a logical channel through which data can be
sent/received to an application. Any host may have multiple applications
running, and each of these applications is identified using the port number on
which they are running.
A port number is a 16-bit integer, hence, we have 216 ports available which are
categorized as shown below:
Port Types Range
List of Ports
•
Network topology refers to the arrangement of different elements like nodes,
links, or devices in a computer network. Common types of network topology
include bus, star, ring, mesh, and tree topologies, each with its advantages and
disadvantages. In this article, we will discuss different types of network topology
in detail.
What is Network Topology?
Network topology is the way devices are connected in a network. It defines how
these components are connected and how data transter between the network.
Understanding the different types of network topologies can help in choosing the
right design for a specific network.
There are two major categories of Network Topology i.e. Physical Network
topology and Logical Network Topology. Physical Network Topology refers to the
actual structure of the physical medium for the transmission of data. Logical
network Topology refers to the transmission of data between devices present in
the network irrespective of the way devices are connected. The structure of the
network is important for the proper functioning of the network. one must choose
the most suitable topology as per their requirement.
Types of Network Topology
Below mentioned are the types of Network Topology
• Point to Point Topology
• Mesh Topology
• Star Topology
• Bus Topology
• Ring Topology
• Tree Topology
• Hybrid Topology
A strong understanding of network topologies is essential for competitive exams
like GATE, where computer networks are a significant subject. To deepen your
knowledge and enhance your exam preparation, consider enrolling in the GATE
CS Self-Paced Course . This course covers all critical networking concepts,
including detailed explanations of various network topologies, equipping you
with the expertise needed to excel in your exams.
Point to Point Topology
Point-to-point topology is a type of topology that works on the functionality of the
sender and receiver. It is the simplest communication between two nodes, in
which one is the sender and the other one is the receiver. Point-to-Point provides
high bandwidth.
Mesh Topology
In a mesh topology, every device is connected to another device via a particular
channel. Every device is connected to another via dedicated channels. These
channels are known as links. In Mesh Topology, the protocols used are AHCP (Ad
Hoc Configuration Protocols), DHCP (Dynamic Host Configuration Protocol), etc.
Mesh Topology
• Suppose, the N number of devices are connected with each other in a mesh
topology, the total number of ports that are required by each device is N-1. In
Figure 1, there are 5 devices connected to each other, hence the total number
of ports required by each device is 4. The total number of ports required = N *
(N-1).
• Suppose, N number of devices are connected with each other in a mesh
topology, then the total number of dedicated links required to connect them
is N C 2 i.e. N(N-1)/2. In Figure 1, there are 5 devices connected to each other,
hence the total number of links required is 5*4/2 = 10.
Advantages of Mesh Topology
• Communication is very fast between the nodes.
• Mesh Topology is robust.
• The fault is diagnosed easily. Data is reliable because data is transferred
among the devices through dedicated channels or links.
• Provides security and privacy.
Disadvantages of Mesh Topology
• Installation and configuration are difficult.
• The cost of cables is high as bulk wiring is required, hence suitable for less
number of devices.
• The cost of maintenance is high.
A common example of mesh topology is the internet backbone, where various
internet service providers are connected to each other via dedicated channels.
This topology is also used in military communication systems and aircraft
navigation systems.
Star Topology
In Star Topology, all the devices are connected to a single hub through a cable. This
hub is the central node and all other nodes are connected to the central node. The
hub can be passive in nature i.e., not an intelligent hub such as broadcasting
devices, at the same time the hub can be intelligent known as an active hub. Active
hubs have repeaters in them. Coaxial cables or RJ-45 cables are used to connect
the computers. In Star Topology, many popular Ethernet LAN protocols are used
as CD(Collision Detection), CSMA (Carrier Sense Multiple Access), etc.
Star Topology
Bus Topology
Tree Topology
Tree topology is the variation of the Star topology. This topology has a hierarchical
flow of data. In Tree Topology, protocols like DHCP and SAC (Standard
Automatic Configuration) are used.
Tree Topology
In tree topology, the various secondary hubs are connected to the central hub
which contains the repeater. This data flow from top to bottom i.e. from the central
hub to the secondary and then to the devices or from bottom to top i.e. devices to
the secondary hub and then to the central hub. It is a multi-point connection and a
non-robust topology because if the backbone fails the topology crashes.
Advantages of Tree Topology
• It allows more devices to be attached to a single central hub thus it decreases
the distance that is traveled by the signal to come to the devices.
• It allows the network to get isolated and also prioritize from different
computers.
• We can add new devices to the existing network.
• Error detection and error correction are very easy in a tree topology.
Disadvantages of Tree Topology
• If the central hub gets fails the entire system fails.
• The cost is high because of the cabling.
• If new devices are added, it becomes difficult to reconfigure.
A common example of a tree topology is the hierarchy in a large organization. At
the top of the tree is the CEO, who is connected to the different departments or
divisions (child nodes) of the company. Each department has its own hierarchy,
with managers overseeing different teams (grandchild nodes). The team members
(leaf nodes) are at the bottom of the hierarchy, connected to their respective
managers and departments.
Hybrid Topology
Hybrid Topology is the combination of all the various types of topologies we have
studied above. Hybrid Topology is used when the nodes are free to take any form.
It means these can be individuals such as Ring or Star topology or can be a
combination of various types of topologies seen above. Each individual topology
uses the protocol that has been discussed earlier.
Hybrid Topology
The above figure shows the structure of the Hybrid topology. As seen it contains
a combination of all different types of networks.
Advantages of Hybrid Topology
• This topology is very flexible .
• The size of the network can be easily expanded by adding new devices.
Disadvantages of Hybrid Topology
• It is challenging to design the architecture of the Hybrid Network.
• Hubs used in this topology are very expensive.
• The infrastructure cost is very high as a hybrid network requires a lot of
cabling and network devices .
A common example of a hybrid topology is a university campus network. The
network may have a backbone of a star topology, with each building connected to
the backbone through a switch or router. Within each building, there may be a bus
or ring topology connecting the different rooms and offices. The wireless access
points also create a mesh topology for wireless devices. This hybrid topology
allows for efficient communication between different buildings while providing
flexibility and redundancy within each building.
Why is Network Topology Important?
Network Topology is important because it defines how devices are connected
and how they communicate in the network. Here are some points that defines
why network topology is important.
• Network Performance: Upon choosing the appropriate topology as per
requirement, it helps in running the network easily and hence increases
network performance.
• Network Reliability: Some topologies like Star, Mesh are reliable as if one
connection fails, they provide an alternative for that connection, hence it
works as a backup.
• Network Expansion: Chosing correct topology helps in easier expansion of
Network as it helps in adding more devices to the network without disrupting
the actual network.
• Network Security: Network Topology helps in understanding how devices
are connected and hence provides a better security to the network.
Conclusion
In conclusion, network topologies play a crucial role in determining the efficiency
and reliability of a computer network. Each topology, whether it’s bus, star, ring,
mesh, or tree, offers unique benefits and potential drawbacks. By understanding
these different arrangements, network designers can choose the most appropriate
topology to meet the specific needs of their systems, ensuring optimal
performance and connectivity.
Frequently Asked Questions on Types of Network
Topology – FAQs
Which topology is best for large networks?
For large networks, mesh and tree topologies are often preferred. Mesh topology
offers high reliability and redundancy, while tree topology supports scalability and
efficient data organization.
Can different topologies be combined in a single network?
Yes, different topologies can be combined in a hybrid topology to take advantage of
the strengths of each type, improving overall network performance and reliability.
Which topology is the simplest and cheapest to set up?
Bus topology is the simplest and cheapest to set up, as it uses a single cable to
connect all devices. However, it’s better suited for smaller networks.
Why is hybrid topology used in large networks?
Hybrid topology combines the strengths of different topologies to suit complex or
large networks.
How do I choose the right network topology for my needs?
Choosing the right network topology depends on factors such as the size of your
network, budget, desired performance, and the need for reliability and scalability.
Assess your specific requirements to make an informed decision.
•
A Physical and Logical topologies are important concepts that govern the
formation and operation of networks. In this article we will see differences
between both topologies, and troubleshooting network infrastructure.
What is Physical Topology?
Physical topology indicates the arrangement of different elements of a network. It
reflects the physical layout of devices and cables to form a connected network. It
is concerned with the essentials of the network ignoring minute details like
transfer of data and device type. The pattern of arrangement of nodes (computers)
and network cables depends on the ease of installation and setup of the network.
It affects cost and bandwidth capacity based on a solution of devices. It takes into
account the placement of nodes and the distance between them. Devices can be
arranged to form a ring (Ring Topology) or linearly connected in a line called Bus
Topology.
Types of Physical Topology
The arrangement of a network that comprises nodes and connecting lines via
sender and receiver is referred to as Network Topology. On the basis of
arrangements, Physical Topology has several types:
1. Mesh Topology
2. Star Topology
3. Bus Topology
4. Ring Topology
5. Hybrid Topology
Advantages of Physical Topology
• Reliability: Some physical topologies, including the mesh topology, provide
redundancy, making sure that community connectivity is maintained although
a connection or device fails.
• Tangible Representation: Physical topology offers a concrete representation
of how devices are physically linked, aiding in troubleshooting and
maintainence responsibilities.
• Scalability: Certain physical topologies, like the star topology, provide
scalability, allowing for smooth expansion by means of including extra
devices.
Disadvantages of Physical Topology
• Vulnerability to Physical Damage: Physical topologies are liable to
disruptions resulting from physical damage to cables or networking
hardware.
• Limited Flexibility: Changing a network’s physical architecture can be
difficult and involve a significant amount of reconfiguration.
• Costly Implementation: Some physical topologies can be quite expensive to
build, especially if they include a lot of cables or redundant hardware.
What is Logical Topology?
Logical Topology reflects the arrangement of devices and their communication. It
is the transmission of data over physical topology. It is independent of physical
topology, irrespective of the arrangements of nodes. It is concerned with intricate
details of network like type of devices (switches, routers) chosen and their quality,
which affects rate and speed of data packets delivery. The logical topology ensures
optimal flow control that can be regulated within network. The data can either
flow in a linear pattern called Logical bus or in form of a circle Logical ring.
Types of Logical Topology
Logical topology refers to the manner in which the data is transported and the
network device structure is displayed. On the basis of data transfer, logical
topology have below mentioned types:
1. Ethernet
2. TCP/IP
3. OSI
Advantages of Logical Topology
• Flexibility: Logical topology allows community engineers to design and
configure networks based totally on logical necessities, without being
constrained by using physical limitations.
• Efficient Resource Utilization: Using logical topology to define efficient
information paths and routing configurations, the most efficient use of
resources is made possible.
• Ease of Implementation: Making changes or improvements to a logical
topology is frequently less difficult and disruptive than making changes to a
community’s physical layout.
Disadvantages of Logical Topology
• Complexity: Technical expertise and understanding may also be needed to
comprehend and manage the complexities of logical topology, which includes
protocols and routing configurations.
• Dependency on Protocols: Logical topology is contingent upon the proper
functioning of network protocols, making networks prone to issues arising
from protocol failures or misconfigurations.
• Potential Security Risks: Misconfigurations or vulnerabilities in logical
topology components, which include routing protocols, may leads to security
risk
Difference between Physical and Logical Topology
Physical Topology Logical Topology
This has major impact on cost, scalability This has major impact on speed and delivery
and bandwidth capacity of network based of data packets. It also handles flow control
on selection and availability of devices. and ordered delivery of data packets.
Physical Topology Logical Topology
•
The OSI (Open Systems Interconnection) Model is a set of rules that explains
how different computer systems communicate over a network. OSI Model was
developed by the International Organization for Standardization (ISO). The
OSI Model consists of 7 layers and each layer has specific functions and
responsibilities.
This layered approach makes it easier for different devices and technologies to
work together. OSI Model provides a clear structure for data transmission and
managing network issues. The OSI Model is widely used as a reference to
understand how network systems function.
In this article, we will discuss the OSI Model and each layer of the OSI Model in
detail. We will also discuss the flow of data in the OSI Model and how the OSI
Model is different from the TCP/IP Model.
OSI Model
Physical Layer
Application Layer
Functions of the Application Layer
The main functions of the application layer are given below.
• Network Virtual Terminal(NVT): It allows a user to log on to a remote host.
• File Transfer Access and Management(FTAM): This application allows a
user to access files in a remote host, retrieve files in a remote host, and
manage or control files from a remote computer.
• Mail Services: Provide email service.
• Directory Services: This application provides distributed database sources
and access for global information about various objects and services.
How Data Flows in the OSI Model?
When we transfer information from one device to another, it travels through 7
layers of OSI model. First data travels down through 7 layers from the sender’s
end and then climbs back 7 layers on the receiver’s end.
Data flows through the OSI model in a step-by-step process:
• Application Layer: Applications create the data.
• Presentation Layer: Data is formatted and encrypted.
• Session Layer: Connections are established and managed.
• Transport Layer: Data is broken into segments for reliable delivery.
• Network Layer: Segments are packaged into packets and routed.
• Data Link Layer: Packets are framed and sent to the next device.
• Physical Layer: Frames are converted into bits and transmitted physically.
Each layer adds specific information to ensure the data reaches its destination
correctly, and these steps are reversed upon arrival.
We can understand how data flows through OSI Model with the help of an example
mentioned below.
Let us suppose, Person A sends an e-mail to his friend Person B.
Step 1: Person A interacts with e-mail application like Gmail, outlook, etc.
Writes his email to send. (This happens at Application Layer).
Step 2: At Presentation Layer, Mail application prepares for data transmission
like encrypting data and formatting it for transmission.
Step 3: At Session Layer, There is a connection established between the sender
and receiver on the internet.
Step 4: At Transport Layer, Email data is broken into smaller segments. It adds
sequence number and error-checking information to maintain the reliability of the
information.
Step 5: At Network Layer, Addressing of packets is done in order to find the best
route for transfer.
Step 6: At Data Link Layer, data packets are encapsulated into frames, then MAC
address is added for local devices and then it checks for error using error
detection.
Step 7: At Physical Layer, Frames are transmitted in the form of electrical/
optical signals over a physical network medium like ethernet cable or WiFi.
After the email reaches the receiver i.e. Person B, the process will reverse and
decrypt the e-mail content. At last, the email will be shown on Person B email
client.
Protocols Used in the OSI Layers
Protocol
Layer Working Data Unit Protocols
Establishing Physical
1 – Physical
Connections between Bits USB, SONET/SDH, etc.
Layer
Devices.
Transmission of data
3 – Network from one host to IP, ICMP, IGMP, OSPF,
Packets
Layer another, located in etc.
different networks.
Establishes Connection,
5 – Session Maintenance, Ensures
Data NetBIOS, RPC, PPTP, etc.
Layer Authentication and
Ensures security.
OSI stands for Open Systems TCP/IP stands for Transmission Control
Interconnection. Protocol/Internet Protocol.
In the OSI model, Only layers 1,2 and 3 are All layers of the TCP/IP model are needed for
necessary for data transmission. data transmission.
Protocols at each layer is independent of Layers are integrated, some layers are
the other layer. required by other layers of TCP/IP model.
OSI Model is a conceptual framework, less Widely used in actual networks like Internet
used in practical applications. and Communication Systems.
OSI vs TCP/IP
•
The physical Layer is the bottom-most layer in the Open System
Interconnection (OSI) Model which is a physical and electrical
representation of the system. It consists of various network components such
as power plugs, connectors, receivers, cable types, etc. The physical layer
sends data bits from one device(s) (like a computer) to another device(s). The
physical Layer defines the types of encoding (that is how the 0’s and 1’s are
encoded in a signal). The physical Layer is responsible for the communication
of the unstructured raw data streams over a physical medium.
The Physical layer is the first layer in the OSI (Open Systems
Interconnection) model, which is a conceptual framework that standardizes
the functions of a communication system. The Physical layer deals with the
physical transmission of data bits over a communication channel. It defines
the electrical, mechanical, and procedural aspects of transmitting raw data
between network devices. It primarily focuses on converting digital data into
a format suitable for transmission and ensuring reliable and efficient
communication at the physical level.
Q.2: What are the primary functions of the Physical layer?
Answer:
The main functions of the Physical layer include:
Encoding and signaling: It defines the method of encoding digital data into
electrical, optical, or radio signals for transmission over the physical medium.
Physical media: It specifies the characteristics of the physical media used for
data transmission, such as cables, fiber optics, or wireless channels.
Data transmission: It establishes the rules for transmitting raw data bits over
the physical medium, including aspects like bit synchronization, line coding,
and error detection.
Physical topologies: It defines the physical arrangement or layout of network
devices and how they are connected, such as bus, star, ring, or mesh
topologies.
Transmission modes: It describes the ways in which data is transmitted
between devices, such as simplex (one-way), half-duplex (two-way but not
simultaneously), or full-duplex (two-way simultaneously).
Are you a student in Computer Science or an employed professional looking
to take up the GATE 2025 Exam? Of course, you can get a good score in it
but to get the best score our GATE CS/IT 2025 - Self-Paced Course is
available on GeeksforGeeks to help you with its preparation. Get
comprehensive coverage of all topics of GATE, detailed explanations,
and practice questions for study. Study at your pace. Flexible and easy-to-
follow modules. Do well in GATE to enhance the prospects of your career.
Enroll now and let your journey to success begin!
•
The data link layer is the second layer from the bottom in the OSI (Open System
Interconnection) network architecture model. It is responsible for the node-to-
node delivery of data. Its major role is to ensure error-free transmission of
information. DLL is also responsible for encoding, decoding, and organizing the
outgoing and incoming data.
This is considered the most complex layer of the OSI model as it hides all the
underlying complexities of the hardware from the other above layers. In this
article, we will discuss Data Link Layer in Detail along with its functions, and sub-
layers.
OSI Model: Data Link Layer
Framing
The packet received from the Network layer is known as a frame in the Data link
layer. At the sender’s side, DLL receives packets from the Network layer and
divides them into small frames, then, sends each frame bit-by-bit to the physical
layer. It also attaches some special bits (for error control and addressing) at the
header and end of the frame. At the receiver’s end, DLL takes bits from the Physical
layer organizes them into the frame, and sends them to the Network layer.
Addressing
The data link layer encapsulates the source and destination’s MAC address/
physical address in the header of each frame to ensure node-to-node delivery.
MAC address is the unique hardware address that is assigned to the device while
manufacturing.
Error Control
Data can get corrupted due to various reasons like noise, attenuation, etc. So, it is
the responsibility of the data link layer, to detect the error in the transmitted data
and correct it using error detection and correction techniques respectively. DLL
adds error detection bits into the frame’s header, so that receiver can check
received data is correct or not. It adds reliability to phyiscal layer by adding
mechansims to detect and retransmit damaged or lost frames.
Flow Control
If the receiver’s receiving speed is lower than the sender’s sending speed, then this
can lead to an overflow in the receiver’s buffer and some frames may get lost. So,
it’s the responsibility of DLL to synchronize the sender’s and receiver’s speeds and
establish flow control between them.
Access Control
When multiple devices share the same communication channel there is a high
probability of collision, so it’s the responsibility of DLL to check which device has
control over the channel and CSMA/CD and CSMA/CA can be used to avoid
collisions and loss of frames in the channel.
Protocols in Data link layer
There are various protocols in the data link layer, which are as follows:
• Synchronous Data Link Protocol (SDLC)
• High-Level Data Link Protocol (HDLC)
• Serial Line Interface Protocol (SLIP) for encoding
• Point to Point Protocol (PPP)
• Link Access Procedure (LAP)
• Link Control Protocol (LCP)
• Network Control Protocol (NCP)
Conclusion
In conclusion, the Data Link Layer is essential for ensuring that data is transferred
reliably and accurately across a network. It handles error detection and
correction, manages data frame sequencing, and provides access to the physical
network. By organizing data into frames and controlling how devices on the
network communicate, the Data Link Layer plays a crucial role in maintaining
smooth and efficient network operations.
Frequently Asked Questions on Data Link Layer – FAQs
What is the purpose of framing in the Data Link Layer?
Framing involves encapsulating data into frames with headers and trailers, allowing
the receiver to identify the start and end of each frame and to distinguish between
different frames.
What is MAC address in the Data Link Layer?
MAC (Media Access Control) address is a unique hardware address assigned to
network interfaces at the Data Link Layer. It is used to identify devices on a network.
What is the difference between a MAC address and an IP address?
A MAC address is a hardware address associated with a network interface card, while
an IP address is a logical address used for routing data packets in a network. MAC
addresses are used at the Data Link Layer, and IP addresses are used at the Network
Layer.
Session Layer in OSI model
Last Updated : 12 Jan, 2022
•
Prerequisite : OSI Layer
Introduction :
The Session Layer is the 5th layer in the Open System Interconnection (OSI)
model. This layer allows users on different machines to establish active
communications sessions between them. It is responsible for establishing,
maintaining, synchronizing, terminating sessions between end-user
applications. In Session Layer, streams of data are received and further
marked, which is then resynchronized properly, so that the ends of the
messages are not cut initially and further data loss is avoided. This layer
basically establishes a connection between the session entities. This layer
handles and manipulates data which it receives from the Session Layer as
well as from the Presentation Layer.
Application Layer
Presentation Layer
Present Layer=> Session Layer
Transport Layer
Network Layer
Data Layer
Physical Layer
Working of Session Layer :
Session Layer, which is the 5th layer in the OSI model, uses the services
provided by The transport layer, enables applications to establish and
maintain sessions and to synchronize the sessions.
Now, in order to establish a session connection, several things should be
followed.
First thing is we should map the session address to the shipping address.
The second thing is that we need to select the required transport quality of
service (also referred as QoS) parameters. Next thing is we need to take
care of the negotiations which should happen between session parameters.
Then we further need to transmit limited transparent user data. Then at last,
we need to monitor Data Transfer phase properly. The ability to send larger
amount of data files is extremely important and a necessary thing too.
Functions of Session Layer :
The session layer being the fifth layer in the OSI model performs several
different as well as important functions which are need for establishing as
well as maintaining a safe and secure connection.
Pause
Unmute
Pause
Unmute
Data from Presentation Layer <=> Session layer <=> Data from
Transport Layer
Following are some of the functions which are performed by Session Layer –
• Session Layer works as a dialog controller through which it allows
systems to communicate in either half-duplex mode or full duplex mode of
communication.
• This layer is also responsible for token management, through which it
prevents two users to simultaneously access or attempting the same
critical operation.
• This layer allows synchronization by allowing the process of adding
checkpoints, which are considered as synchronization points to the
streams of data.
• This layer is also responsible for session checkpointing and recovery.
• This layer basically provides a mechanism of opening, closing and
managing a session between the end-user application processes.
• The services offered by Session Layer are generally implemented in
application environments using remote procedure calls (RPCs).
• The Session Layer is also responsible for synchronizing information from
different sources.
• This layer also controls single or multiple connections for each-end user
application and directly communicates with both Presentation and
transport layers.
• Session Layer creates procedures for checkpointing followed by
adjournment, restart and termination.
• Session Layer uses checkpoints to enable communication sessions which
are to be resumed from that particular checkpoint at which communication
failure has occurred.
• The session Layer is responsible for fetching or receiving data information
from its previous layer (transport layer) and further sends data to the layer
after it (presentation layer).
Session Layer Protocols :
Session Layer uses some protocols which are required for safe, secure and
accurate communication which exists between two-ender user applications.
Following are some of the protocols provided or used by the Session Layer –
• AppleTalk Data Stream Protocol (ADSP): ADSP is that type of protocol
which was developed by Apple Inc. and it includes a number of features
that allow local area networks to be connected with no prior setup. This
protocol was released in 1985.
This protocol rigorously followed the OSI model of protocol layering.
ADSP itself has two protocols named: AppleTalk Address Resolution
Protocol (AARP) and Name Binding Protocol (NBP), both aimed at
making system self-configuring.
• Real-time Transport Control Protocol (RTCP): RTCP is a protocol
which provides out-of-band statistics and control information for an RTP
(Real-time Transport Protocol) session. RTCP’s primary function is to
provide feedback on the quality of service (QoS) in media distribution by
periodically sending statistical information such as transmitted octet and
packet counts or packet loss to the participants in the streaming
multimedia session.
• Point-to-Point Tunneling Protocol (PPTP): PPTP is a protocol which
provides a method for implementing virtual private networks. PPTP uses a
TCP control channel and a Generic Routing Encapsulation tunnel to
encapsulate PPP (Point-to-Point Protocol) packets This protocol provides
security levels and remote access levels comparable with typical VPN
(Virtual Private Network) products.
• Password Authentication Protocol (PAP): Password Authentication
Protocol is a password-based authentication protocol used by Point to
Point Protocol (PPP) to validate users. Almost all network operating
systems, remote servers support PAP. PAP authentication is done at the
time of the initial link establishment and verifies the identity of the client
using a two-way handshake (Client-sends data and server in return sends
Authentication-ACK (Acknowledgement) after the data sent by client is
verified completely).
• Remote Procedure Call Protocol (RPCP): Remote Procedure Call
Protocol (RPCP) is a protocol that is used when a computer program
causes a procedure (or a sub-routine) to execute in a different address
space without the programmer explicitly coding the details for the remote
interaction. This is basically the form of client-server interaction, typically
implemented via a request-response message-passing system.
• Sockets Direct Protocol (SDP): Sockets Direct Protocol (SDP) is a
protocol that supports streams of sockets over Remote Direct Memory
Access (RDMA) network fabrics.
The purpose of SDP is to provide an RDMA-accelerated alternative to the
TCP protocol. The primary goal is to perform one particular thing in such
a manner which is transparent to the application.
•
Prerequisite : OSI Model
Introduction : Presentation Layer is the 6th layer in the Open System
Interconnection (OSI) model. This layer is also known as Translation layer, as
this layer serves as a data translator for the network. The data which this layer
receives from the Application Layer is extracted and manipulated here as per the
required format to transmit over the network. The main responsibility of this
layer is to provide or define the data format and encryption. The presentation
layer is also called as Syntax layer since it is responsible for maintaining the
proper syntax of the data which it either receives or transmits to other layer(s).
Application Layer
Present Layer=> Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Layer
Physical Layer
Functions of Presentation Layer :
Data from Application Layer <=> Presentation layer <=> Data from
Session Layer
The presentation layer, being the 6th layer in the OSI model, performs several
types of functions, which are described below-
• Presentation layer format and encrypts data to be sent across the network.
• This layer takes care that the data is sent in such a way that the receiver will
understand the information (data) and will be able to use the data efficiently
and effectively.
• This layer manages the abstract data structures and allows high-level data
structures (example- banking records), which are to be defined or exchanged.
• This layer carries out the encryption at the transmitter and decryption at the
receiver.
• This layer carries out data compression to reduce the bandwidth of the data
to be transmitted (the primary goal of data compression is to reduce the
number of bits which is to be transmitted).
• This layer is responsible for interoperability (ability of computers to exchange
and make use of information) between encoding methods as different
computers use different encoding methods.
• This layer basically deals with the presentation part of the data.
• Presentation layer, carries out the data compression (number of bits
reduction while transmission), which in return improves the data throughput.
• This layer also deals with the issues of string representation.
• The presentation layer is also responsible for integrating all the formats into a
standardized format for efficient and effective communication.
• This layer encodes the message from the user-dependent format to the
common format and vice-versa for communication between dissimilar
systems.
• This layer deals with the syntax and semantics of the messages.
• This layer also ensures that the messages which are to be presented to the
upper as well as the lower layer should be standardized as well as in an
accurate format too.
• Presentation layer is also responsible for translation, formatting, and delivery
of information for processing or display.
• This layer also performs serialization (process of translating a data structure
or an object into a format that can be stored or transmitted easily).
Features of Presentation Layer in the OSI model: Presentation layer, being the
6th layer in the OSI model, plays a vital role while communication is taking place
between two devices in a network.
List of features which are provided by the presentation layer are:
• Presentation layer could apply certain sophisticated compression techniques,
so fewer bytes of data are required to represent the information when it is
sent over the network.
• If two or more devices are communicating over an encrypted connection, then
this presentation layer is responsible for adding encryption on the sender’s
end as well as the decoding the encryption on the receiver’s end so that it can
represent the application layer with unencrypted, readable data.
• This layer formats and encrypts data to be sent over a network, providing
freedom from compatibility problems.
• This presentation layer also negotiates the Transfer Syntax.
• This presentation layer is also responsible for compressing data it receives
from the application layer before delivering it to the session layer (which is
the 5th layer in the OSI model) and thus improves the speed as well as the
efficiency of communication by minimizing the amount of the data to be
transferred.
Working of Presentation Layer in the OSI model :
Presentation layer in the OSI model, as a translator, converts the data sent by the
application layer of the transmitting node into an acceptable and compatible data
format based on the applicable network protocol and architecture. Upon arrival
at the receiving computer, the presentation layer translates data into an
acceptable format usable by the application layer. Basically, in other words, this
layer takes care of any issues occurring when transmitted data must be viewed in
a format different from the original format. Being the functional part of the OSI
mode, the presentation layer performs a multitude (large number of) data
conversion algorithms and character translation functions. Mainly, this layer is
responsible for managing two network characteristics: protocol (set of rules) and
architecture.
Presentation Layer Protocols :
Presentation layer being the 6th layer, but the most important layer in the OSI
model performs several types of functionalities, which makes sure that data
which is being transferred or received should be accurate or clear to all the
devices which are there in a closed network.
Presentation Layer, for performing translations or other specified functions,
needs to use certain protocols which are defined below –
• Apple Filing Protocol (AFP): Apple Filing Protocol is the proprietary
network protocol (communications protocol) that offers services to macOS or
the classic macOS. This is basically the network file control protocol
specifically designed for Mac-based platforms.
• Lightweight Presentation Protocol (LPP): Lightweight Presentation
Protocol is that protocol which is used to provide ISO presentation services on
the top of TCP/IP based protocol stacks.
• NetWare Core Protocol (NCP): NetWare Core Protocol is the network
protocol which is used to access file, print, directory, clock synchronization,
messaging, remote command execution and other network service functions.
• Network Data Representation (NDR): Network Data Representation is
basically the implementation of the presentation layer in the OSI model,
which provides or defines various primitive data types, constructed data
types and also several types of data representations.
• External Data Representation (XDR): External Data Representation (XDR)
is the standard for the description and encoding of data. It is useful for
transferring data between computer architectures and has been used to
communicate data between very diverse machines. Converting from local
representation to XDR is called encoding, whereas converting XDR into local
representation is called decoding.
• Secure Socket Layer (SSL): The Secure Socket Layer protocol provides
security to the data that is being transferred between the web browser and
the server. SSL encrypts the link between a web server and a browser, which
ensures that all data passed between them remains private and free from
attacks.
•
The Application Layer of OSI (Open System Interconnection) model, is the top
layer in this model and takes care of network communication. The application
layer provides the functionality to send and receive data from users. It acts as the
interface between the user and the application. The application provides services
like file transmission, mail service, and many more.
In this article we will explore the application layer in the OSI model, application
layer functions, the working of the application layer, and services provided by the
application layer.
Table of Content
• What is Application Layer in OSI Model?
• Functions of Application Layer
• Working of Application Layer in OSI Model
• Features Provided by Application Layer Protocols
• Services Provided by Application Layer Protocols
• Application Layer Protocols
What is an Application Layer in OSI Model?
Application Layer is the topmost layer in the Open System Interconnection (OSI)
model. This layer provides several ways for manipulating the data (information)
which actually enables any type of user to access network with ease. This layer
also makes a request to its bottom layer, which is presentation layer for receiving
various types of information from it.
The Application Layer interface directly interacts with application and provides
common web application services. This layer is basically highest level of open
system, which provides services directly for application process.
Application Layer
Presentation LayerSession LayerTransport LayerNetwork LayerData
LayerPhysical Layer
Functions of Application Layer
The Application Layer, as discussed above, being topmost layer in OSI model,
performs several kinds of functions which are requirement in any kind of
application or communication process. Following are list of functions which are
performed by Application Layer of OSI Model:
Data from User <=> Application layer <=> Data from Presentation Layer
• Application Layer provides a facility by which users can forward several
emails and it also provides a storage facility.
• This layer allows users to access, retrieve and manage files in a remote
computer.
• It allows users to log on as a remote host.
• This layer provides access to global information about various services.
• This layer provides services which include: e-mail, transferring files,
distributing results to the user, directory services, network resources and so
on.
• It provides protocols that allow software to send and receive information and
present meaningful data to users.
• It handles issues such as network transparency, resource allocation and so on.
• This layer serves as a window for users and application processes to access
network services.
• Application Layer is basically not a function, but it performs application layer
functions.
• The application layer is actually an abstraction layer that specifies the shared
protocols and interface methods used by hosts in a communication network.
• Application Layer helps us to identify communication partners, and
synchronizing communication.
• This layer allows users to interact with other software applications.
• In this layer, data is in visual form, which makes users truly understand data
rather than remembering or visualize the data in the binary format (0’s or
1’s).
• This application layer basically interacts with Operating System (OS) and thus
further preserves the data in a suitable manner.
• This layer also receives and preserves data from it’s previous layer, which is
Presentation Layer (which carries in itself the syntax and semantics of the
information transmitted).
• The protocols which are used in this application layer depend upon what
information users wish to send or receive.
• This application layer, in general, performs host initialization followed by
remote login to hosts.
Working of Application Layer in OSI Model
The application layer in the OSI model generally acts only like the interface which
is responsible for communicating with host-based and user applications. This is in
contrast with TCP/IP protocol, wherein the layers below the application layer,
which is Session Layer and Presentation layer, are clubbed together and form a
simple single layer which is responsible for performing the functions, which
includes controlling the dialogues between computers, establishing as well as
maintaining as well as ending a particular session, providing data compression
and data encryption and so on.
Working of Application Layer
• At first, client sends a command to server and when server receives that
command, it allocates port number to client.
• Thereafter, the client sends an initiation connection request to server and
when server receives request, it gives acknowledgement (ACK) to client
through client has successfully established a connection with the server.
• Therefore, now client has access to server through which it may either ask
server to send any types of files or other documents or it may upload some
files or documents on server itself.
Features Provided by Application Layer Protocols
To ensure smooth communication, application layer protocols are implemented
the same on source host and destination host.
The following are some of the features which are provided by Application layer
protocols-
• The Application Layer protocol defines process for both parties which are
involved in communication.
• These protocols define the type of message being sent or received from any
side (either source host or destination host).
• These protocols also define basic syntax of the message being forwarded or
retrieved.
• These protocols define the way to send a message and the expected response.
• These protocols also define interaction with the next level.
•
Protocols and standards are important in computer networks. They are like the
rules and guidelines that allow different devices and systems to communicate and
work together smoothly. Protocols define how data is sent, received, and
processed, while standards ensure that various technologies are compatible with
each other. This coordination is critical for the Internet and other networks to
function constantly and efficiently.
Network protocol ensures that different technologies and components of the
network are compatible with one another, reliable, and able to function
together. In this article, we are going to discuss every point about protocols and
standards in computer networks.
What is Protocol?
A protocol is a set of rules that determines how data is sent and received over a
network. The protocol is just like a language that computers use to talk to each
other, ensuring they understand and can respond to each other’s messages
correctly. Protocols help make sure that data moves smoothly and securely
between devices on a network.
To make communication successful between devices, some rules and procedures
should be agreed upon at the sending and receiving ends of the system. Such rules
and procedures are called Protocols. Different types of protocols are used for
different types of communication.
Protocols
In the above diagrams, Protocols are shown as a set of rules. Communication
between the Sender and Receiver is not possible without Protocol.
Key Elements of Protocol
• Syntax: Syntax refers to the structure or the format of the data that gets
exchanged between the devices. Syntax of the message includes the type of
data, composition of the message, and sequencing of the message. The
starting 8 bits of data are considered as the address of the sender. The next 8
bits are considered to be the address of the receiver. The remaining bits are
considered as the message itself.
• Semantics: Semantics defines data transmitted between devices. It provides
rules and norms for understanding message or data element values and
actions.
• Timing: Timing refers to the synchronization and coordination between
devices while transferring the data. Timing ensures at what time data should
be sent and how fast data can be sent. For example, If a sender sends 100
Mbps but the receiver can only handle 1 Mbps, the receiver will overflow and
lose data. Timing ensures preventing of data loss, collisions, and other timing-
related issues.
• Sequence Control: Sequence control ensures the proper ordering of data
packets. The main responsibility of sequence control is to acknowledge the
data while it get received, and the retransmission of lost data. Through this
mechanism, the data is delivered in correct order.
• Flow Control: Flow control regulates device data delivery. It limits the
sender’s data or asks the receiver if it’s ready for more. Flow control prevents
data congestion and loss.
• Error Control: Error control mechanisms detect and fix data transmission
faults. They include error detection codes, data resend, and error recovery.
Error control detects and corrects noise, interference, and other problems to
maintain data integrity.
• Security : Network security protects data confidentiality, integrity, and
authenticity. which includes encryption, authentication, access control, and
other security procedures. Network communication’s privacy and
trustworthiness are protected by security standards.
Types of Protocol
• Network Layer Protocols : Network layer protocols operate in the network
layer which is also known as the Layer 3 of the network architecture.
Network layer protocols are responsible for packet routing, forwarding, and
addressing of data packets throughout the network. IP and ICMP are the
network layer protocols.
• Transport Layer Protocols: Transport layer protocols work in the transport
layer which provides end-to-end service ensuring data transfer across apps
on different devices. TCP and UDP are the most popular transport layer
protocols.
• Application Layer Protocol: Application layer protocol working in the
application layer of the network architecture provides communication
between applications running on different devices. The application layer
protocols enable cross-device communication. They format, exchange, and
interpret application data. HTTP, FTP, and SMTP are examples.
• Wireless Protocols: Wireless protocols basically used in wireless
communication which enables data transfer through wireless
networks. Bluetooth, Wi-Fi, and LTE protocols are examples.
• Routing Protocols: Routing protocol establishes the best/optimal network
pathways throughout the network for fastest data transmission. Routers
share information to develop and maintain routing tables. RIP, OSPF,
and BGP are examples.
• Security Protocols : security protocol protects data confidentiality, integrity,
and authenticity while transmission of data over the network. They
include SSL and TLS, encryption methods, and authentication protocols for
providing data security.
• Internet Protocols : IP identifies devices uniquely. Internet protocol
provides data communication through routing and forwarding data packets
from one device to another by unique addressing scheme.
Important Protocols Used in Computer Network
Here are some key protocols that are widely used in computer networks:
• TCP (Transmission Control Protocol): Ensures data is sent and received
accurately by breaking it into packets, sending them, and reassembling them
at the destination.
• IP (Internet Protocol): Addresses and routes the packets to make sure they
reach the right destination.
• HTTP/HTTPS (HyperText Transfer Protocol/Secure): HTTP used for
transferring web pages on the internet. When you browse a website, your
browser uses HTTP to request and display web pages. And HTTPs is a secure
version of HTTP that encrypts data to protect it from being intercepted.
• FTP (File Transfer Protocol): Used for transferring files between computers
on a network. It allows users to upload and download files.SMTP (Simple
Mail Transfer Protocol): Used for sending emails. It transfers emails from a
client to a server or between servers.
• DNS (Domain Name System): It is used to translates human-readable
domain names (like www.example.com) into IP addresses that computers use
to identify each other on the network.
• DHCP (Dynamic Host Configuration Protocol): Automatically assigns IP
addresses to devices on a network, ensuring each device has a unique
address.
• SSH (Secure Shell): Provides a secure way to access and manage devices
over a network. It encrypts the data, making it safe from eavesdropping.
• SNMP (Simple Network Management Protocol): Used for managing and
monitoring network devices like routers, switches, and servers. It collects and
organizes information about these devices
How are Protocols Used in Cyber Attacks?
Attackers can misuse the rules of how data is sent over the internet to cause
problems for systems. One common way they do this is through distributed denial-
of-service (DDoS) attacks.
For example, in a SYN flood attack, attackers exploit the TCP protocol. Normally, a
device sends a SYN packet to a server to start a connection, and the server
responds, expecting a final response to complete the connection. Attackers send
many SYN packets but never complete the connections. This overloads the server,
preventing it from working properly for real users.
Cloudflare offers solutions to stop these kinds of attacks. One of their services,
Cloudflare Magic Transit, protects against attacks targeting different levels of the
network system. In the case of a SYN flood attack, Cloudflare manages the TCP
connections for the server, so the server doesn’t get overwhelmed and can
continue to serve real users.
What is Standards?
Standards are the set of rules for data communication that are needed for the
exchange of information among devices. It is important to follow Standards which
are created by various Standard Organizations like IEEE, ISO, ANSI, etc.
Types of Standards
• De Facto Standard: The meaning of the word ” De Facto ” is ” By Fact ” or
“By Convention”. These are the standards that have not been approved by any
Organization but have been adopted as Standards because of their
widespread use. Also, sometimes these standards are often established by
Manufacturers.
For example : Apple and Google are two companies that established their
own rules for their products which are different. Also, they use some same
standard rules for manufacturing their products.
• De Jure Standard: The meaning of the word “De Jure” is “By Law” or
“By Regulations”.Thus, these are the standards that have been approved by
officially recognized bodies like ANSI, ISO, IEEE, etc. These are the standards
that are important to follow if it is required or needed.
For example : All the data communication standard protocols like SMTP,
TCP, IP, UDP etc. are important to follow the same when we need them.
Protocol and Standard Compliance in Network Security
• Interoperability: Protocols and standards allow devices and systems to
communicate. These protocols ensure network components can function
together, avoiding risks and security gaps produced by incompatible or
unsupported systems.
• Security Baseline : Protocols and standards contain security principles and
best practices that help secure network infrastructure. These protocols allow
organizations to protect sensitive data via encryption, authentication, and
access controls.
• Vulnerability Management : Network security protocols and standards help
organizations find and fix vulnerabilities. Many standards requires regular
security assessments, vulnerability scanning, and penetration testing to
discover network infrastructure flaws. Organizations can
prevent cyberattacks and address vulnerabilities by following these
compliance criteria.
Best Practices for Ensuring Protocol and Standard
Compliance
• Use cryptography tools to secure personal data transported across your
network, making sure that data encryption methods exceed industry
requirements.
• Perform frequent security checks on all network devices to discover
vulnerabilities and verify they fulfil compliance standards.
• Restrict user access to specified network zones to ensure secure data sharing
and prevent unauthorized access.
Conclusion
Protocols and standards enable secure and efficient
computer network communication. They regulate data exchange, formatting,
endpoints, and reliable device communication. These protocols and standards
ensure network security and performance. Compliance can prevent data breaches
and system breakdowns.
Frequently Asked Question on Protocol and Standards –
FAQs
What is the role of organizations like the IEEE and the IETF in protocol
development?
Organizations such as the IEEE and the IETF play important roles in defining and
maintaining networking protocols and standards. They provide platforms for
experts to cooperate, analyze suggestions, and reach agreements on new protocols
or changes to current ones.
Why are protocols and standards important in networking?
Protocols and standards ensure that devices from multiple companies may
communicate with one another effectively. They also contribute to consistent and
reliable data transfer, resulting in efficient networking operations.
What are some common networking protocols?
• TCP/IP
• FTP
• SMTP
• HTTP
•
Data Link Layer protocols are generally responsible to simply ensure and
confirm that the bits and bytes that are received are identical to the bits and
bytes being transferred. It is basically a set of specifications that are used for
implementation of data link layer just above the physical layer of the Open
System Interconnections (OSI) Model.
Some Common Data Link Protocols :
There are various data link protocols that are required for Wide Area
Network (WAN) and modem connections. Logical Link Control (LLC) is a
data link protocol of Local Area Network (LAN). Some of data link protocols
are given below :
1. Synchronous Data Link Protocol (SDLC) –
SDLC is basically a communication protocol of computer. It usually
supports multipoint links even error recovery or error correction also. It is
usually used to carry SNA (Systems Network Architecture) traffic and is
present precursor to HDLC. It is also designed and developed by IBM in
1975. It is also used to connect all of the remote devices to mainframe
computers at central locations may be in point-to-point (one-to-one) or
point-to-multipoint (one-to-many) connections. It is also used to make
sure that the data units should arrive correctly and with right flow from one
network point to next network point.
TCP/IP Model
Last Updated : 05 Aug, 2024
•
The TCP/IP model is a fundamental framework for computer networking. It stands
for Transmission Control Protocol/Internet Protocol, which are the core protocols
of the Internet. This model defines how data is transmitted over networks,
ensuring reliable communication between devices. It consists of four layers: the
Link Layer, the Internet Layer, the Transport Layer, and the Application Layer.
Each layer has specific functions that help manage different aspects of network
communication, making it essential for understanding and working with modern
networks.
TCP/IP was designed and developed by the Department of Defense (DoD) in the
1960s and is based on standard protocols. The TCP/IP model is a concise version
of the OSI model. It contains four layers, unlike the seven layers in the OSI model.
In this article, we are going to discuss the TCP/IP model in detail.
TCP/IP model was developed alongside the creation of the ARPANET, which later
became the foundation of the modern internet. It was designed with a focus on the
practical aspects of networking at the time. The lower-level hardware details and
physical transmission medium were largely abstracted away in favor of higher-
level networking protocols.
What Does TCP/IP Do?
The main work of TCP/IP is to transfer the data of a computer from one device to
another. The main condition of this process is to make data reliable and accurate
so that the receiver will receive the same information which is sent by the sender.
To ensure that, each message reaches its final destination accurately, the TCP/IP
model divides its data into packets and combines them at the other end, which
helps in maintaining the accuracy of the data while transferring from one end to
another end. The TCP/IP model is used in the context of the real-world internet,
where a wide range of physical media and network technologies are in use. Rather
than specifying a particular Physical Layer, the TCP/IP model allows for flexibility
in adapting to different physical implementations.
Difference Between TCP and IP
TCP (Transmission
Feature Control Protocol) IP (Internet Protocol)
TCP/IP uses both the session and presentation OSI uses different session and
layer in the application layer itself. presentation layers.
The Transport layer in TCP/IP does not In the OSI model, the transport layer
provide assurance delivery of packets. provides assurance delivery of packets.
•
User Datagram Protocol (UDP) is a Transport Layer protocol. UDP is a part of
the Internet Protocol suite, referred to as UDP/IP suite. Unlike TCP, it is
an unreliable and connectionless protocol. So, there is no need to establish a
connection before data transfer. The UDP helps to establish low-latency and loss-
tolerating connections over the network. The UDP enables process-to-process
communication.
What is User Datagram Protocol?
User Datagram Protocol (UDP) is one of the core protocols of the Internet Protocol
(IP) suite. It is a communication protocol used across the internet for time-
sensitive transmissions such as video playback or DNS lookups . Unlike
Transmission Control Protocol (TCP), UDP is connectionless and does not
guarantee delivery, order, or error checking, making it a lightweight and efficient
option for certain types of data transmission.
UDP Header
UDP header is an 8-byte fixed and simple header, while for TCP it may vary from
20 bytes to 60 bytes. The first 8 Bytes contain all necessary header information
and the remaining part consists of data. UDP port number fields are each 16 bits
long, therefore the range for port numbers is defined from 0 to 65535; port
number 0 is reserved. Port numbers help to distinguish different user requests or
processes.
UDP Header
• Source Port: Source Port is a 2 Byte long field used to identify the port
number of the source.
• Destination Port: It is a 2 Byte long field, used to identify the port of the
destined packet.
• Length: Length is the length of UDP including the header and the data. It is a
16-bits field.
• Checksum: Checksum is 2 Bytes long field. It is the 16-bit one’s complement
of the one’s complement sum of the UDP header, the pseudo-header of
information from the IP header, and the data, padded with zero octets at the
end (if necessary) to make a multiple of two octets.
Notes – Unlike TCP, the Checksum calculation is not mandatory in UDP. No Error
control or flow control is provided by UDP. Hence UDP depends on IP and ICMP
for error reporting. Also UDP provides port numbers so that is can differentiate
between users requests.
Applications of UDP
• Used for simple request-response communication when the size of data is less
and hence there is lesser concern about flow and error control.
• It is a suitable protocol for multicasting as UDP supports packet switching.
• UDP is used for some routing update protocols like RIP(Routing Information
Protocol).
• Normally used for real-time applications which can not tolerate uneven
delays between sections of a received message.
• VoIP (Voice over Internet Protocol) services, such as Skype and WhatsApp,
use UDP for real-time voice communication. The delay in voice
communication can be noticeable if packets are delayed due to congestion
control, so UDP is used to ensure fast and efficient data transmission.
• DNS (Domain Name System) also uses UDP for its query/response messages.
DNS queries are typically small and require a quick response time, making
UDP a suitable protocol for this application.
• DHCP (Dynamic Host Configuration Protocol) uses UDP to dynamically assign
IP addresses to devices on a network. DHCP messages are typically small, and
the delay caused by packet loss or retransmission is generally not critical for
this application.
• Following implementations uses UDP as a transport layer protocol:
o NTP (Network Time Protocol)
o DNS (Domain Name Service)
o BOOTP, DHCP.
o NNP (Network News Protocol)
o Quote of the day protocol
o TFTP, RTSP, RIP.
• The application layer can do some of the tasks through UDP-
o Trace Route
o Record Route
o Timestamp
• UDP takes a datagram from Network Layer , attaches its header, and sends it
to the user. So, it works fast.
TCP vs UDP
Transmission Control Protocol User Datagram
Basis (TCP) Protocol (UDP)
There is no sequencing of
Sequencing of data is a feature of
data in UDP. If the order is
Transmission Control Protocol (TCP).
required, it has to be
this means that packets arrive in order
managed by the
at the receiver.
Sequence application layer.
There is no retransmission
Retransmission of lost packets is
of lost packets in the User
possible in TCP, but not in UDP.
Retransmission Datagram Protocol (UDP).
TCP has a (20-60) bytes variable length UDP has an 8 bytes fixed-
Header Length header. length header.
UDP supports
TCP doesn’t support Broadcasting.
Broadcasting Broadcasting.
UDP connection is a
The TCP connection is a byte stream.
Stream Type message stream.
Advantages of UDP
• Speed: UDP is faster than TCP because it does not have the overhead of
establishing a connection and ensuring reliable data delivery.
• Lower latency: Since there is no connection establishment, there is lower
latency and faster response time.
• Simplicity: UDP has a simpler protocol design than TCP, making it easier to
implement and manage.
• Broadcast support: UDP supports broadcasting to multiple recipients,
making it useful for applications such as video streaming and online gaming.
• Smaller packet size: UDP uses smaller packet sizes than TCP, which can
reduce network congestion and improve overall network performance.
• User Datagram Protocol (UDP) is more efficient in terms of both latency and
bandwidth.
Disadvantages of UDP
• No reliability: UDP does not guarantee delivery of packets or order of
delivery, which can lead to missing or duplicate data.
• No congestion control: UDP does not have congestion control, which means
that it can send packets at a rate that can cause network congestion.
• Vulnerable to attacks: UDP is vulnerable to denial-of-service attacks , where
an attacker can flood a network with UDP packets, overwhelming the network
and causing it to crash.
• Limited use cases: UDP is not suitable for applications that require reliable
data delivery, such as email or file transfers, and is better suited for
applications that can tolerate some data loss, such as video streaming or
online gaming.
How is UDP used in DDoS attacks?
A UDP flood attack is a type of Distributed Denial of Service (DDoS) attack
where an attacker sends a large number of User Datagram Protocol
(UDP) packets to a target port.
• UDP Protocol : Unlike TCP, UDP is connectionless and doesn’t require a
handshake before data transfer. When a UDP packet arrives at a server, it
checks the specified port for listening applications. If no app is found, the
server sends an ICMP “destination unreachable” packet to the supposed
sender (usually a random bystander due to spoofed IP addresses).
• Attack Process :
o The attacker sends UDP packets with spoofed IP sender addresses to
random ports on the target system.
o The server checks each incoming packet’s port for a listening
application (usually not found due to random port selection).
o The server sends ICMP “destination unreachable” packets to the
spoofed sender (random bystanders).
o The attacker floods the victim with UDP data packets, overwhelming
its resources.
• Mitigation : To protect against UDP flood attacks, monitoring network traffic
for sudden spikes and implementing security measures are crucial.
Organizations often use specialized tools and services to detect and mitigate
such attacks effectively.
UDP Pseudo Header
• The purpose of using a pseudo-header is to verify that the UDP packet has
reached its correct destination
• The correct destination consist of a specific machine and a specific protocol
port number within that machine
UDP pseudo header
•
The address through which any computer communicates with our computer is
simply called an Internet Protocol Address or IP address. For example, if we want
to load a web page or download something, we require the address to deliver that
particular file or webpage. That address is called an IP Address.
There are two versions of IP: IPv4 and IPv6. IPv4 is the older version, while IPv6
is the newer one. Both have their own features and functions, but they differ in
many ways. Understanding these differences helps us see why we need IPv6 as the
internet grows and evolves.
What is IP?
An IP, or Internet Protocol address, is a unique set of numbers assigned to each
device connected to a network, like the Internet. It’s like an address for your
computer, phone, or any other device, allowing them to communicate with each
other. When you visit a website, your device uses the IP address to find and
connect to the website’s server.
Types of IP Addresses
• IPv4 (Internet Protocol Version 4)
• IPv6 (Internet Protocol Version 6)
What is IPv4?
IPv4 addresses consist of two things: the network address and the host address. It
stands for Internet Protocol version four. It was introduced in 1981 by
DARPA and was the first deployed version in 1982 for production on SATNET and
on the ARPANET in January 1983.
IPv4 addresses are 32-bit integers that have to be expressed in Decimal Notation.
It is represented by 4 numbers separated by dots in the range of 0-255, which have
to be converted to 0 and 1, to be understood by Computers. For Example, An IPv4
Address can be written as 189.123.123.90.
IPv4 Address Format
IPv4 Address Format is a 32-bit Address that comprises binary digits separated by
a dot (.).
IPv4 has a 32-bit address length IPv6 has a 128-bit address length
It can generate 4.29×10 9 address The address space of IPv6 is quite large it can
space produce 3.4×10 38 address space
The Security feature is dependent IPSEC is an inbuilt security feature in the IPv6
on the application protocol
In IPv4 Packet flow identification In IPv6 packet flow identification are Available and
is not available uses the flow label field in the header
IPv4 has a header of 20-60 bytes. IPv6 has a header of 40 bytes fixed
IPv4 can be converted to IPv6 Not all IPv6 can be converted to IPv4
IPv4 consists of 4 fields which are IPv6 consists of 8 fields, which are separated by a
separated by addresses dot (.) colon (:)
Example of IPv6:
Example of IPv4: 66.94.29.13
2001:0000:3238:DFE1:0063:0000:0000:FEFB
•
Two basic forms of networking communication are connection-oriented and
connection-less services. In order to provide dependable communication,
connection-oriented services create a dedicated connection before transferring
data. On the other hand, connection-less services prioritize speed and efficiency
over reliability by transmitting data without establishing a connection. These
types of services are offered by the network layer.
What is a Connection-Oriented Service?
Connection-oriented service is related to the telephone system. It includes
connection establishment and connection termination. In a connection-oriented
service, the Handshake method is used to establish the connection between sender
and receiver. Before data transmission starts, connection-oriented services create
a dedicated communication channel between the sender and the recipient. As the
connection is kept open until all data is successfully transferred, this guarantees
dependable data delivery. One example is TCP (Transmission Control Protocol),
which ensures error-free and accurate data packet delivery.
Ex: TCP (Transmission Control Protocol) Ex: UDP (User Datagram Protocol)
Conclusion
Depending on the particular requirements of the application, connection-oriented
or connection-less services might be chosen. While connection-less services offer
faster and more flexible communication, they are better suited for real-time
applications where speed is crucial. Connection-oriented services, on the other
hand, offer reliability and ordered delivery, making them excellent for critical data
transfer.
Difference Between Connection-oriented and
Connection-less Services – FAQs
What benefits do connection-oriented services offer?
They guarantee that data arrives intact and in order by offering dependable data
transfer, error detection, and correction.
When is a connection-less service used?
When speed and efficiency are more important than dependability, use a
connection-less service (e.g., VoIP (Voice over IP), live streaming, online gaming).
What kinds of services are connection-oriented?
Examples include the Transmission Control Protocol (TCP), which establishes and
maintains a connection during the exchange of messages.
•
This article describes a very basic one-way Client and Server setup where a Client
connects, sends messages to the server and the server shows them using a socket
connection. There’s a lot of low-level stuff that needs to happen for these things to
work but the Java API networking package (java.net) takes care of all of that,
making network programming very easy for programmers.
Client-Side Programming
Establish a Socket Connection
To connect to another machine we need a socket connection. A socket connection
means the two machines have information about each other’s network location
(IP Address) and TCP port. The java.net.Socket class represents a Socket. To open
a socket:
Socket socket = new Socket(“127.0.0.1”, 5000)
• The first argument – IP address of Server. ( 127.0.0.1 is the IP address of
localhost, where code will run on the single stand-alone machine).
• The second argument – TCP Port. (Just a number representing which
application to run on a server. For example, HTTP runs on port 80. Port
number can be from 0 to 65535)
Communication
To communicate over a socket connection, streams are used to both input and
output the data.
Closing the connection
The socket connection is closed explicitly once the message to the server is sent.
In the program, the Client keeps reading input from a user and sends it to the
server until “Over” is typed.
Java Implementation
• Java
import java.io.*;
import java.net.*;
// establish a connection
try {
System.out.println("Connected");
socket.getOutputStream());
}
catch (UnknownHostException u) {
System.out.println(u);
return;
catch (IOException i) {
System.out.println(i);
return;
while (!line.equals("Over")) {
try {
line = input.readLine();
out.writeUTF(line);
catch (IOException i) {
System.out.println(i);
}
try {
input.close();
out.close();
socket.close();
catch (IOException i) {
System.out.println(i);
Server Programming
Establish a Socket Connection
To write a server application two sockets are needed.
• A ServerSocket which waits for the client requests (when a client makes a
new Socket())
• A plain old Socket to use for communication with the client.
Communication
getOutputStream() method is used to send the output through the socket.
Close the Connection
After finishing, it is important to close the connection by closing the socket as
well as input/output streams.
• Java
import java.net.*;
import java.io.*;
{
// starts server and waits for a connection
try
System.out.println("Server started");
socket = server.accept();
System.out.println("Client accepted");
in = new DataInputStream(
new BufferedInputStream(socket.getInputStream()));
while (!line.equals("Over"))
{
try
line = in.readUTF();
System.out.println(line);
catch(IOException i)
System.out.println(i);
System.out.println("Closing connection");
// close connection
socket.close();
in.close();
catch(IOException i)
System.out.println(i);
}
Important Points
• Server application makes a ServerSocket on a specific port which is 5000. This
starts our Server listening for client requests coming in for port 5000.
• Then Server makes a new Socket to communicate with the client.
socket = server.accept()
• The accept() method blocks(just sits there) until a client connects to the server.
• Then we take input from the socket using getInputStream() method. Our Server
keeps receiving messages until the Client sends “Over”.
• After we’re done we close the connection by closing the socket and the input
stream.
• To run the Client and Server application on your machine, compile both of
them. Then first run the server application and then run the Client application.
To run on Terminal or Command Prompt
Open two windows one for Server and another for Client
1. First run the Server application as,
$ java Server
Server started
Waiting for a client …
2. Then run the Client application on another terminal as,
$ java Client
It will show – Connected and the server accepts the client and shows,
Client accepted
3. Then you can start typing messages in the Client window. Here is a sample
input to the Client
Hello
I made my first socket connection
Over
Which the Server simultaneously receives and shows,
Hello
I made my first socket connection
Over
Closing connection
Notice that sending “Over” closes the connection between the Client and the
Server just like said before.
If you’re using Eclipse or likes of such-
1. Compile both of them on two different terminals or tabs
2. Run the Server program first
3. Then run the Client program
4. Type messages in the Client Window which will be received and shown by the
Server Window simultaneously.
5. Type Over to end.
•
ServerSocket Class is used for providing system-independent
implementation of the server-side of a client/server Socket Connection. The
constructor for ServerSocket throws an exception if it can’t listen on the
specified port (for example, the port is already being used).
It is widely used so the applications of java.net.ServerSocket class which is
as follows:
1. In java.nio channel, ServerSocket class is used for retrieving a
serverSocket associated with this channel.
2. In java.rmi.Server, ServerSocket class is used to create a server socket
on the specified port (port 0 indicates an anonymous port).
3. In javax.net, Server socket is used widely so as to:
• return an unbound server socket.
• return a server socket bound to the specified port.
• return a server socket bound to the specified port, and uses the
specified connection backlog.
• return a server socket bound to the specified port, with a specified
listen backlog and local IP.
Let us do go through the methods of this class which is as follows:
Method Description
setPerformancePreferences(int
Sets performance preferences for this
connectionTime, int latency, int
ServerSocket
bandwidth)
implementation:
Example 1 Server-Side
• Java
// Server Side
import java.io.*;
import java.net.*;
// Main class
try {
// Establishing a connection
// object
DataInputStream dis
= new DataInputStream(soc.getInputStream());
ss.close();
catch (Exception e) {
System.out.println(e);
Output:
•
URL known as Uniform Resource Locator is simply a string of text that identifies
all the resources on the Internet, telling us the address of the resource, how to
communicate with it, and retrieve something from it.
Components of a URL
A URL can have many forms. The most general however follows a three-
components system as proposed below:
1. Protocol: HTTP is the protocol here
2. Hostname: Name of the machine on which the resource lives.
3. File Name: The pathname to the file on the machine.
4. Port Number: Port number to which to connect (typically optional).
URL Class
The URL class is the gateway to any of the resources available on the internet. A
Class URL represents a Uniform Resource Locator, which is a pointer to a
“resource” on the World Wide Web. A resource can point to a simple file or
directory, or it can refer to a more complicated object, such as a query to a
database or to a search engine.
getPort() Returns the port associated with the protocol specified by the URL
the Returns the query part of URL. A query is a part after the ‘?’ in the
getQuery() URL. Whenever logic is used to display the result, there would be a
query field in the URL. It is similar to querying a database.
Returns the reference of the URL object. Usually, the reference is the
getRef() part marked by a ‘#’ in the URL. You can see the working example by
querying anything on Google and seeing the part after ‘#’
Example:
• Java
import java.net.MalformedURLException;
import java.net.URL;
// Main class
// URL class
throws MalformedURLException
"https://www.google.co.in/?gfe_rd=cr&ei=ptYq"
+ "WK26I4fT8gfth6CACg#q=geeks+for+geeks+java");
"/jvm-works-jvm-architecture/");
"https://www.google.co.in/search?"
+ "q=gnu&rlz=1C1CHZL_enIN71"
+ "4IN715&oq=gnu&aqs=chrome..69i57j6"
+ "9i60l5.653j0j7&sourceid=chrome&ie=UTF"
+ "-8#q=geeks+for+geeks+java");
System.out.println(url1.toString());
System.out.println(url2.toString());
System.out.println();
System.out.println(
System.out.println("Protocol:- "
+ url3.getProtocol());
+ url3.getDefaultPort());
Output:
https://www.google.co.in/?gfe_rd=cr&ei=ptYqWK26I4fT8gfth6CACg#q=geeks+
for+geeks+java
https://www.geeksforgeeks.org/jvm-works-jvm-architecture/