For working professionals
For fresh graduates
More
1. Introduction
6. PyTorch
9. AI Tutorial
10. Airflow Tutorial
11. Android Studio
12. Android Tutorial
13. Animation CSS
16. Apex Tutorial
17. App Tutorial
18. Appium Tutorial
21. Armstrong Number
22. ASP Full Form
23. AutoCAD Tutorial
27. Belady's Anomaly
30. Bipartite Graph
35. Button CSS
39. Cobol Tutorial
46. CSS Border
47. CSS Colors
48. CSS Flexbox
49. CSS Float
51. CSS Full Form
52. CSS Gradient
53. CSS Margin
54. CSS nth Child
55. CSS Syntax
56. CSS Tables
57. CSS Tricks
58. CSS Variables
61. Dart Tutorial
63. DCL
65. DES Algorithm
83. Dot Net Tutorial
86. ES6 Tutorial
91. Flutter Basics
92. Flutter Tutorial
95. Golang Tutorial
96. Graphql Tutorial
100. Hive Tutorial
103. Install Bootstrap
107. Install SASS
109. IPv 4 address
110. JCL Programming
111. JQ Tutorial
112. JSON Tutorial
113. JSP Tutorial
114. Junit Tutorial
115. Kadanes Algorithm
116. Kafka Tutorial
117. Knapsack Problem
118. Kth Smallest Element
119. Laravel Tutorial
122. Linear Gradient CSS
129. Memory Hierarchy
133. Mockito tutorial
134. Modem vs Router
135. Mulesoft Tutorial
136. Network Devices
138. Next JS Tutorial
139. Nginx Tutorial
141. Octal to Decimal
142. OLAP Operations
143. Opacity CSS
144. OSI Model
145. CSS Overflow
146. Padding in CSS
148. Perl scripting
149. Phases of Compiler
150. Placeholder CSS
153. Powershell Tutorial
158. Pyspark Tutorial
161. Quality of Service
162. R Language Tutorial
164. RabbitMQ Tutorial
165. Redis Tutorial
166. Redux in React
167. Regex Tutorial
170. Routing Protocols
171. Ruby On Rails
172. Ruby tutorial
173. Scala Tutorial
175. Shadow CSS
178. Snowflake Tutorial
179. Socket Programming
180. Solidity Tutorial
181. SonarQube in Java
182. Spark Tutorial
189. TCP 3 Way Handshake
190. TensorFlow Tutorial
191. Threaded Binary Tree
196. Types of Queue
197. TypeScript Tutorial
198. UDP Protocol
202. Verilog Tutorial
204. Void Pointer
205. Vue JS Tutorial
206. Weak Entity Set
207. What is Bandwidth?
208. What is Big Data
209. Checksum
211. What is Ethernet
214. What is ROM?
216. WPF Tutorial
217. Wireshark Tutorial
218. XML Tutorial
The OSI model is a fundamental framework in computer networking that helps understand how data is transmitted across networks. It offers a structured approach to network communication by breaking down the complex process into seven layers. In this article, you will be taken on a journey through each layer of the OSI model, where their functions, practical examples in Java, and significance in the overall communication process will be explored.
The OSI model, conceptualized by the International Organization for Standardization (IOS), offers a layered approach, allowing developers and network administrators to focus on specific aspects of the communication process without having to consider the entire system at once. The full form of the OSI model is Open Systems Interconnection. Let's delve into each OSI model layer explanation and unravel their roles.
The Physical Layer serves as the foundation of the OSI model, dealing with the actual physical transmission of data over the network medium. It encompasses the electrical, mechanical, and functional specifications required to establish and maintain physical connections between devices. Ethernet cables and wireless signals are examples of the physical layer in action.
Example: Suppose you have two computers, A and B, connected through an Ethernet cable. Let's see how the Physical Layer plays a role in their communication.
In this Java example, the Physical Layer is responsible for converting the digital data (the string "Hello, Computer B!") into electrical signals and transmitting them over the Ethernet cable to Computer B.
The Data Link Layer ensures error-free transmission of data between adjacent network nodes. It packages data into frames, adds necessary control information, and performs error detection and correction. Ethernet switches operate at this layer, facilitating efficient and reliable data transfer within a local network.
Example: Let's consider a scenario where Computer A wants to send a file to Computer B within the same local network. The Data Link Layer ensures reliable transmission of the data.
In this Java example, the Data Link Layer breaks the file into smaller frames, adds control information such as source and destination MAC addresses, and performs error detection using techniques like cyclic redundancy check (CRC).
The Functions of the Data Link Layer
- Framing: Dividing data into manageable frames for transmission.
- Error Detection and Correction: Adding checksums to detect and correct errors in the received frames.
- Media Access Control (MAC): Controlling access to the network medium to prevent data collisions.
- Flow Control: Regulating the flow of data to match the speed of the receiving device.
The network layer in the OSI model enables the delivery of data packets across multiple networks. It determines the optimal path for data transmission, handles logical addressing, and provides services like routing and forwarding. Internet Protocol (IP) operates at this layer.
Example: Let's explore how the Network Layer facilitates communication between two computers in different networks.
In this Java example, the Network Layer is responsible for routing the packet across different networks to reach the destination computer.
The Transport Layer ensures the reliable and orderly delivery of data between end systems. It breaks data into smaller units called segments, manages flow control, performs error recovery, and provides end-to-end communication services. The popular protocols TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) operate at this layer.
Example: Let's examine how the Transport Layer facilitates communication between two applications using TCP.
In this Java example, the Transport Layer uses TCP to establish a reliable connection between the sender (Computer A) and the receiver (Computer B) and ensures the complete and ordered delivery of the data.
The Functions of the Transport Layer
- Segmenting and Reassembling: Breaking data into smaller segments for transmission and reassembling them at the receiving end.
- Connection Establishment and Termination: Establishing and terminating logical connections between applications.
- Error Control: Detecting and recovering from errors in the data transmission process.
- Flow Control: Regulating the flow of data to prevent overwhelming the receiving device.
The Session Layer establishes, manages, and terminates communication sessions between applications. It allows applications on different devices to establish a dialogue, synchronize their actions, and manage checkpoints for error recovery. This layer provides services like session establishment, maintenance, and termination.
Example: Let's consider a scenario where two applications need to establish a session for communication.
In this Java example, the Session Layer enables establishing and terminating a session between two applications.
The Functions of the Session Layer
- Session Establishment, Maintenance, and Termination: Establishing, maintaining, and terminating communication sessions between applications.
- Synchronization: Allowing applications to synchronize their actions and exchange data in an organized manner.
- Checkpointing: Creating checkpoints to support error recovery and data integrity during a session.
The Presentation Layer handles data representation, encryption, and compression. It ensures that data is in a format that can be understood by the receiving application. This layer is responsible for transforming the data into a suitable format for transmission, performing encryption and compression if required.
Example: Let's explore how the Presentation Layer handles data representation and encryption.
In this Java example, the Presentation Layer encodes the message using Base64 representation, ensuring that the data is in a suitable format for transmission and can be correctly interpreted by the receiving application.
The Functions of the Presentation Layer
- Data Representation: Handling data formats and transformations to ensure compatibility between different systems.
- Encryption and Decryption: Providing secure data transmission by encrypting and decrypting the data.
- Compression: Reducing the size of data to optimize transmission efficiency.
The Application Layer represents the layer closest to the end user and includes all the protocols and services that they interact with directly. It enables network services such as file transfer, email, web browsing, and remote file access. Protocols such as HTTP, FTP, SMTP, and SSH operate at this layer.
Example: Let's take a look at how the Application Layer facilitates web browsing.
import java.net.*;
import java.io.*;
public class ApplicationLayerExample {
public static void main(String[] args) throws Exception {
String url = "http://www.example.com";zzzzz
// Create a URL object
URL websiteURL = new URL(url);
// Open a connection to the website
HttpURLConnection connection = (HttpURLConnection) websiteURL.openConnection();
// Get the response code
int responseCode = connection.getResponseCode();
// Print the response code
System.out.println("Response Code: " + responseCode);
// Read the response
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
StringBuilder response = new StringBuilder();
while ((line = reader.readLine()) != null) {
response.append(line);
}
reader.close();
// Print the response
System.out.println("Response: " + response.toString());
// Close the connection
connection.disconnect();
}
}
In this Java example, the Application Layer uses the HTTP protocol to establish a connection with a website and retrieve the web page content.
The Functions of the Application Layer
- Providing Services to End Users: Facilitating network services and protocols that end-users interact with directly.
- Supporting Applications: Enabling applications such as email, file transfer, web browsing, and remote file access.
- Layered Approach: Divides the complex communication process into manageable layers.
- Modular Design: Each layer performs specific functions and operates independently of other layers.
- Protocol Independence: Allows for different protocols to operate within each layer.
- Standardization: Provides a standardized framework for network communication.
OSI and TCP/IP models explain network communication differently. They have many distinctions despite their similarities:
Feature | OSI Model | TCP/IP Model |
Layers | The OSI model has seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application. | The TCP/IP model combines various OSI layers into four layers: Network Interface, Internet, Transport, and Application. |
Layer functions | The OSI model divides network communication into layers with defined functions and responsibilities. | The TCP/IP paradigm emphasizes internet protocol functionality rather than modularity, like the OSI model |
Flexibility | Each layer of the OSI model can add and modify protocols. Flexibility facilitates vendor and technology interoperability. The OSI model is more flexible than the TCP/IP model. | TCP/IP protocols are integrated and less flexible. |
Usage | The OSI model provides a comprehensive foundation but is not as extensively used as the TCP/IP paradigm. Educational and reference uses dominate the OSI model. | The TCP/IP model is the internet communication standard and is widely used in networking technology. |
Protocol stacks | The OSI model permits alternative protocol stacks in each layer, making it more modular and flexible. | Hierarchical protocol stack. Layers have protocols and are tightly integrated. |
Complexity | The seven-layer OSI model helps explain network communication operations. | The four-layer TCP/IP paradigm simplifies internet protocol implementation. |
Application | The OSI model impacted networking technology but is not directly implemented in real-world networks. | Internet infrastructure uses the TCP/IP paradigm, making it practicable for network communication. |
The OSI and TCP/IP models view network communication differently. The TCP/IP paradigm implements internet protocols, while the OSI model provides a modular foundation. Understanding both models helps you get an idea of the network protocols and their functions in diverse networking settings.
The OSI model provides a foundation for understanding network communication. It gives an organized approach to network design, debugging, and interoperability by breaking down the communication process into seven separate stages. Each layer performs particular duties and has specific obligations to ensure reliable and efficient data transmission. Understanding the OSI model can help you learn how networks work and how different protocols and applications interact, whether you're a network administrator, a developer, or an end user.
1. What are some of the issues with the OSI model?
Some of the drawbacks of the OSI model are:
2. What is the OSI model mnemonic?
The OSI model mnemonic commonly used is "Please Do Not Throw Sausage Pizza Away." Each word in the mnemonic represents the first letter of each layer in the OSI model: Physical, Data Link, Network, Transport, Session, Presentation, and Application. This helps in remembering the order of the layers in the OSI model.
3. What are the primary functions of the Data Link Layer?
The Data Link Layer is responsible for the following functions
4. What is the objective behind the OSI model?
The OSI reference model's objective is to guide technology manufacturers and developers so that the digital communications products and software programs they create can interoperate and promote a clear framework. This can explain the functions of an existing networking or telecommunications system.
Author
Talk to our experts. We are available 7 days a week, 9 AM to 12 AM (midnight)
Indian Nationals
1800 210 2020
Foreign Nationals
+918045604032
1.The above statistics depend on various factors and individual results may vary. Past performance is no guarantee of future results.
2.The student assumes full responsibility for all expenses associated with visas, travel, & related costs. upGrad does not provide any a.