Burkay Erturk
6 min readMay 2, 2024

OSI Layers and TCP/IP

— First of all it would be useful to know what is this OSI?

OSI stands for Open System Interconnection. It is a conceptual framework used to make us understand and describe how does the interconnections work. OSI model is theoretical framework that consist of seven layers, each responsible for specific functions in data communication between network devices.

Before getting into details of each seven layers let’s take a brief look of the communication between two network device. PCs , laptops, mobile devices even TVs or your vacuum cleaner that you control from a remote device, all of them are network devices that sends and receives data that we call them end devices. Between two device data is sent according to the protocols that are determined in the very beginning of the network invention. We may call these protocols as the rules or the way that data be transmitted and received. Each end device implements the rules perfectly every time they send and receive the data. The very first protocol that the transmitter device follows while sending every data called ‘ ENCAPSULATION’ which implements all required seven layers starting from seven which is ‘APPLICATION LAYER’ .

7. APPLICATION LAYER : Provides user interfaces and network services for applications. Various protocols are used to facilitate communication between different applications. Some common protocols include HTTP, SMTP, FTP, and DNS.

6. PRESENTATION LAYER : Translates data into a format compatible with the receiving system. The main tasks of the presentation layer include data compression, encryption, and decryption. Compression reduces the size of data to optimize network bandwidth usage, while encryption ensures secure transmission by converting data into an unreadable form using cryptographic algorithms. It plays a crucial role in ensuring seamless communication between different systems by handling tasks related to translating and manipulating data formats.

5. SESSION LAYER : This layer is responsible for establishing, maintaining, and terminating connections between applications. It provides a means for communication to occur between different devices by managing and coordinating their interactions.

4. TRANSPORT LAYER : This layer is responsible for ensuring reliable delivery of data across a network. It’s main function is to facilitate communication between two devices or applications by establishing end-to-end connections and managing the flow of data. The transport layer achieves reliable delivery through two main protocols; TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). We will dive deeper into TCP and UDP later on.

3. NETWORK LAYER : This layer is responsible for handling routing, addressing, and logical organization of data packets. Its main function is to provide a means for data to be transferred from one device to another across different networks. The network layer achieves this by using logical addresses called IP (Internet Protocol) addresses to identify devices and determine the most efficient path for data transmission. It encapsulates data received from the transport layer into packets called IP datagrams, which include source and destination IP addresses.

2. DATA-LINK LAYER : This layer is responsible for providing reliable point-to-point communication between adjacent nodes on a network. It takes the packets from the network layer and encapsulates them into frames that can be transmitted over the physical medium. The data link layer also handles error detection and correction to ensure that data is received accurately. It manages flow control by regulating the flow of data between two nodes to avoid overwhelming slower devices with too much information at once

1- PHYSICAL LAYER: This layer is responsible for the actual physical connections between devices and the transmission of raw data bits over a communication channel. It deals with electrical, mechanical, and procedural aspects of transmitting data signals across physical media, such as copper wires, fiber optics, or wireless transmission.

Let’s take a look how does it look ;

OSI MODEL EXAMPLE

The client who sends the data encapsulates the data starting from Application Layer and releases the data from Physical Layer as we have seen above. Therefore, the receiver device ‘DECAPSULATES’ the data starting from the Physical layer up to Application layer and this way the data reaches to the end point.

As a summary to make it work; it takes all the layers and protocols to work synchronized and proper to send and receive the data. Each device knows how to work when you configure them correctly.

Now let’s take a look to the next subject;

TCP/IP and UDP ( Transmission Control Protocol / Internet Protocol ) (User Datagram Protocol)

TCP/IP (Transmission Control Protocol/Internet Protocol) is a suite of networking protocols that are used to establish and maintain communication between devices on the internet. It provides a standardized set of rules for how data is transmitted, routed, and received across networks.

Here are the main components of TCP/IP:

1. IP (Internet Protocol): The IP protocol is responsible for addressing and routing packets from source to destination across different networks. It assigns unique IP addresses to devices connected to the network and uses these addresses to identify the source and destination of packets.

2. TCP (Transmission Control Protocol): TCP provides reliable, connection-oriented communication between devices on a network. It breaks down data into smaller units called segments, which are then transmitted over the network. TCP ensures that all segments are received in order by performing error detection, retransmission of lost or corrupted segments, and flow control.

3. UDP (User Datagram Protocol): UDP is an alternative transport protocol in TCP/IP that offers connectionless communication without reliability guarantees like those provided by TCP. It sends data in small units called datagrams without establishing a direct connection with the recipient device.

How Does TCP and UDP work ?

Let’s think that you want to connect to any website from your laptop. We already know how is the data sent and received. But why is there TCP or UDP ? We know that when we write a website name to the search bar we actually send an HTTP request. This request is taken in the application layer and encapsulation starts down till it reaches to physical layer. But, there’s something happening on Transport layer that is determined the protocol of the sending data. It is either sent as UDP, TCP or both.

  • TCP is a protocol that builds two way agreement between client and the server. Before sending the HTTP request. The client first sends the SYN packet to the server, this packet contains initial sequence number(ISN) that will be used for data transmission and server sends SYN-ACK that contains it’s own ISN for data transmission to the client and then client responds with ACK packet that acknowledge receipt of the server’s ISN . This is called ‘THREE WAY HANDSHAKE’. The purpose of this three way handshake is to ensure that both ends of communication are ready to send and receive the data. As we can understand from the name that TCP is controlled and ensuring there’s no data lost between two end of the communication.
  • UDP is connectionless and unreliable transport layer protocol. Unlike TCP, UDP doesn’t provide guaranteed delivery or error checking system. UDP is often used for applications that require low latency and can tolerate occasional data loss, such as real-time streaming media, online gaming, DNS (Domain Name System), and Voice over IP (VoIP). Since UDP does not have built-in reliability features like TCP’s acknowledgments and retransmissions, it can be faster but less reliable when it comes to delivering data. Therefore, applications using UDP need to handle packet loss detection and recovery on their own if required.

Overall, UDP provides a lightweight method of transmitting small amounts of data with minimal overhead compared to TCP but sacrifices reliability for efficiency.

Thanks for reading my article you may follow me on linkedin,

www.linkedin.com/in/burkay-erturk

Burkay Erturk
Burkay Erturk

No responses yet