🔹 Connection-Oriented Service (COS)
Definition: A service where a dedicated logical path (connection) is established
before communication starts.
This is similar to making a phone call:
You dial the number (setup phase/handshake).
The other person accepts the call (connection established).
You talk (data transfer).
You hang up (connection release).
o
🔹 Key Phases of COS
1. Connection Setup (Handshake/Negotiation)
o Before sending data, both devices exchange control messages.
o They agree on parameters like sequence numbers, error control, flow control,
etc.
o Example: TCP’s 3-way handshake in networking.
TCP’s 3-Way Handshake
The 3-way handshake is the process TCP uses to:
1. Establish a reliable connection between client and server.
2. Synchronize sequence numbers (for data tracking).
3. Negotiate parameters before actual data transfer.
🔹 Steps of 3-Way Handshake
Step 1: SYN (Synchronize)
Client → Server:
The client sends a SYN packet to the server.
o Indicates client wants to establish connection.
o Chooses an initial sequence number (ISN).
Example: SYN, Seq = X
Step 2: SYN-ACK (Synchronize + Acknowledge)
Server → Client:
The server responds with a SYN + ACK packet.
o ACK acknowledges client’s SYN.
o SYN indicates server is also ready to establish connection.
o Chooses its own initial sequence number.
Example: SYN, Seq = Y, ACK = X+1
Step 3: ACK (Acknowledge)
Client → Server:
The client replies with an ACK packet.
o Acknowledges server’s SYN.
o Confirms connection is established.
Example: ACK, Seq = X+1, ACK = Y+1
2. Data Transfer Phase
o Once the connection is established, data is sent reliably and in order.
o Packets follow the same path, so they arrive sequentially.
3. Connection Release (Teardown)
o After communication ends, the connection is formally terminated.
o Example: TCP FIN/ACK process.
TCP connection termination process using FIN/ACK. This is also called the
TCP 4-Way Handshake.
📘 TCP FIN/ACK Process (Connection Termination)
When two devices (client and server) are done communicating over TCP, they
must gracefully close the connection.
This requires 4 steps, because TCP is full-duplex (data can flow both ways).
Each side must close its half of the connection.
🔹 Steps of TCP Connection Termination
Step 1: FIN (Client → Server)
The client sends a FIN (Finish) packet.
This means: “I have no more data to send, but I can still receive data.”
Step 2: ACK (Server → Client)
The server acknowledges the client’s FIN with an ACK packet.
Now the client → server channel is closed, but the server can still send data.
Step 3: FIN (Server → Client)
When the server has no more data to send, it sends a FIN packet to the client.
Step 4: ACK (Client → Server)
The client acknowledges the server’s FIN with an ACK packet.
Now the server → client channel is closed.
The TCP connection is fully terminated.
🔹 Key Notes
Connection termination takes 4 steps because TCP is bidirectional.
Half-close: After one side sends FIN, it cannot send more data, but it can still receive.
TIME_WAIT State: After the client’s final ACK, it waits for a short period (2×
Maximum Segment Lifetime) to ensure all packets are properly received.
✅ In short:
3-way handshake (SYN/SYN-ACK/ACK) → for connection setup.
4-way handshake (FIN/ACK/FIN/ACK) → for connection termination.
🔹 Features of COS
Reliable delivery (acknowledgments used).
Orderly delivery (data arrives in the same order as sent).
Error control & flow control are built-in.
Dedicated logical path established for communication.
Examples in networking:
o TCP (Transmission Control Protocol) in TCP/IP.
o Traditional telephone networks.
o File transfer protocols.
🔹 Connectionless Service (CLS)
A Connectionless Service is a type of communication where data is sent without establishing
a dedicated connection first.
Each message (packet) is treated independently and may take different routes to reach the
destination.
👉 Analogy: Postal Mail System
You drop a letter in the postbox.
It may take a different route than another letter.
There’s no prior setup or dedicated path.
🔹 Phases of CLS
1. No Setup Phase
o No handshake/negotiation is required.
o Sender just sends the data.
2. Data Transfer
o Packets are sent individually, each with full addressing information.
o They may arrive out of order, or some may be lost.
3. No Connection Release
o Since no connection was established, there’s no teardown process.
🔹 Features of CLS
No prior setup (faster than COS).
Best-effort delivery → no guarantee of reliability or order.
Each packet independent (like standalone envelopes).
Less overhead (extra work, time, or resources added to communication beyond the
actual data you want to send)(good for broadcasting and real-time applications).
🔹 Examples
UDP (User Datagram Protocol) → used in online gaming, video streaming, VoIP.
Postal system (letters sent independently).
Broadcast & multicast communication.
🔹 Comparison Table (Quick View)
Feature Connection-Oriented Connectionless
Setup Required before data transfer Not required
Analogy Telephone system Postal system
Usually unreliable (but can be made
Reliability Usually reliable (ACKs)
reliable)
Data Order Maintained Not guaranteed
Resource
Possible (QoS, bandwidth) Not possible
Reservation
Overhead High (setup + teardown) Low
Efficiency Better for large/continuous data Better for single/bursty messages
Example Protocols TCP IP, UDP
Applications File transfer, email VoIP, video streaming, DNS
Message Can preserve (message
Often not preserved
Boundaries sequence)
Slower startup, but stable after
Speed Faster startup, less stable
setup
Switching Method Often virtual circuit Datagram (store-and-forward)
Built-in retransmission &
Error Handling Left to higher layers
recovery
Flow Control Possible Not possible
Feature Connection-Oriented Connectionless
Cost Higher Lower
ISO-OSI Reference Model
The ISO-OSI Reference Model, also known as the Open Systems Interconnection (OSI)
model, is a 7-layer framework developed by the International Organization for
Standardization (ISO). It defines how data is transmitted over a network by breaking the
process into layers. Each layer has a specific function, and collectively they provide end-to-
end communication between two systems.
The principles that were applied to arrive at the seven layers can be briefly summarized
as follows:
1. A layer should be created where a different abstraction (The process of hiding
unnecessary details and showing only the essential features of something) is needed.
2. Each layer should perform a well-defined function.
3. The function of each layer should be chosen with an eye toward defining internationally
standardized protocols.
4. The layer boundaries should be chosen to minimize the information flow across the
interfaces.
5. The number of layers should be large enough that distinct functions need not be thrown
together in the same layer out of necessity and small enough that the architecture does not
become unwieldy.
📘 Protocol Data Units (PDUs) in OSI Model
1. APDU (Application Protocol Data Unit)
What it is: Data unit at the Application Layer.
What it contains: Actual user data (messages, requests, files) + application-
specific info.
Role: Provides services directly to the user.
Example: An HTTP GET /index.html request, or an email message in SMTP.
2. PPDU (Presentation Protocol Data Unit)
What it is: Data unit at the Presentation Layer.
What it contains: APDU + formatting info (encryption, compression, encoding).
Role: Ensures data is in a form both sender and receiver understand.
Example: An HTTPS (TLS-encrypted) web request, or a compressed video
stream.
3. SPDU (Session Protocol Data Unit)
What it is: Data unit at the Session Layer.
What it contains: PPDU + session control info (session ID, checkpoints).
Role: Manages dialogs, synchronization, and session control.
Example: A video call session with synchronization points to resume after
interruption.
4. TPDU (Transport Protocol Data Unit)
What it is: Data unit at the Transport Layer.
What it contains: SPDU + transport header (port numbers, sequence numbers,
error control).
Role: Ensures reliable delivery (TCP) or fast, connectionless delivery (UDP).
Example:
o TCP segment carrying part of a file with sequence number.
o UDP datagram carrying a DNS query.
5. Packet (Network Layer PDU)
What it is: Data unit at the Network Layer.
What it contains: TPDU + IP header (source & destination IP addresses, routing
info).
Role: Provides logical addressing and routes data across networks.
Example: An IP packet with source IP = 192.168.1.2 and destination IP =
142.250.183.14 (Google).
6. Frame (Data Link Layer PDU)
What it is: Data unit at the Data Link Layer.
What it contains: Packet + frame header/trailer (MAC addresses, error detection
code).
Role: Provides physical addressing (MAC) and error detection on a local link.
Example: An Ethernet frame carrying an IP packet between two switches.
7. Bits (Physical Layer PDU)
What it is: Raw data at the Physical Layer.
What it contains: Stream of 0s and 1s, converted into signals (electrical, optical,
or radio).
Role: Transmits the actual data physically over cables or wireless channels.
Example: Electrical pulses on copper wire, or Wi-Fi radio signals carrying bits.
✅ In summary:
APDU → user’s data (HTTP, email)
PPDU → formatted/encrypted data
SPDU → session-managed data
TPDU → end-to-end segment/datagram (TCP/UDP)
Packet → logical addressing (IP)
Frame → link addressing (MAC)
Bits → physical transmission
Functions of each layer
🔹 1. Physical Layer
Main Role: Deals with raw bits (0s and 1s) and physical transmission.
Functions:
o Defines cables, connectors, voltages, frequencies, transmission medium.
o Converts data into electrical/optical/radio signals.
o Handles data rate, synchronization, topology.
Example: Ethernet cable, Wi-Fi signals, fiber optics.
Analogy: Like the road where vehicles (data) travel.
🔹 2. Data Link Layer
Main Role: Provides error detection and reliable delivery of frames (packets at this
layer).
Functions:
o Framing → divides data into frames.
o Error detection/correction (using CRC).
o Flow control.
o Uses MAC (Media Access Control) and LLC (Logical Link Control)
sublayers.
Example: Ethernet, PPP, Switches.
Analogy: Like the traffic rules/signals on the road that control how vehicles move.
🔹 3. Network Layer
Main Role: Decides how data travels from source to destination (routing).
Functions:
o Logical addressing (IP addresses).
o Routing packets through multiple networks.
o Fragmentation & reassembly.
Example: IP (IPv4/IPv6), Routers.
Analogy: Like Google Maps deciding the best route for you.
🔹 4. Transport Layer
Main Role: Ensures complete and reliable data delivery to the correct application.
Functions:
o Segmentation and reassembly.
o Error recovery (retransmission).
o Flow control.
o Provides connection-oriented (TCP) and connectionless (UDP) services.
Example: TCP, UDP.
Analogy: Like a delivery service ensuring your package reaches safely and
completely.
🔹 5. Session Layer
Main Role: Manages sessions (dialogues) between applications.
Functions:
o Establish, maintain, and terminate communication sessions.
o Synchronization (checkpoints in case of failure).
o Dialog control (half-duplex/full-duplex).
Example: Remote Procedure Call (RPC), NetBIOS.
Analogy: Like a phone operator who connects and manages your call.
🔹 6. Presentation Layer
Main Role: Translates data between application and network formats.
Functions:
o Data translation (ASCII ↔ EBCDIC).
o Data encryption/decryption.
o Data compression/decompression.
Example: SSL/TLS encryption, JPEG, MPEG, GIF.
Analogy: Like a translator converting one language into another.
🔹 7. Application Layer
Main Role: Provides services to end-users and applications.
Functions:
o Network services for applications (email, file transfer, web browsing).
o Identifies communication partners.
o Provides user interfaces.
Example: HTTP, FTP, SMTP, DNS, Telnet.
Analogy: Like the apps on your phone that you directly use.
📘 Summary Table
Layer Functions Examples Analogy
HTTP, FTP, SMTP,
7. Application User services, network apps Apps you use
DNS
6. Presentation Translation, encryption, compression SSL, JPEG, MPEG Translator
5. Session Session control, synchronization NetBIOS, RPC Phone operator
Delivery
4. Transport Reliable delivery, segmentation TCP, UDP
service
3. Network Routing, addressing IP, Routers Google Maps
Framing, MAC addressing, error
2. Data Link Ethernet, Switch Traffic rules
detection
1. Physical Transmission of raw bits Cables, Wi-Fi Road
✅ In short:
Lower layers (1–3) → Handle data transport (bit to packet).
Middle layers (4–5) → Handle reliability & communication management.
Top layers (6–7) → Handle user interaction & application services.
🌐 TCP/IP Reference Model
The TCP/IP model (Transmission Control Protocol / Internet Protocol) is the foundation of
the Internet.
It is a 4-layer model developed by the U.S. Department of Defense (DoD) in the 1970s.
It is simpler and more practical than the 7-layer OSI model and directly maps to real-world
protocols.
Working Principle
When a sender transmits data, it passes down through the TCP/IP layers, where
headers are added at each step (encapsulation).
The data is sent over the network to the receiver.
On the receiver side, the data passes upward through the layers, with headers
removed at each step (decapsulation) until the application gets the original message.
👉 Essentially: Application → Transport → Internet → Network Access (on sender side),
then reversed at receiver side.
Functionality of Each Layer
1. Application Layer
Function: Provides services and protocols for user-level communication.
Combines the functions of OSI’s Application, Presentation, and Session layers.
Handles user interfaces, data formatting, encryption, and session management.
Examples:
o HTTP (Web browsing)
o SMTP, POP3, IMAP (Email)
o FTP (File Transfer)
o DNS (Domain resolution)
Data Unit: Message / Data
2. Transport Layer
Function: Provides end-to-end communication between applications.
Responsible for segmentation, flow control, error control, and reliability.
Two main protocols:
o TCP (Transmission Control Protocol): Reliable, connection-oriented (used
in web, email, file transfer).
o UDP (User Datagram Protocol): Fast, connectionless, no guarantee of
delivery (used in streaming, gaming, VoIP).
Data Unit: Segments (TCP) / Datagrams (UDP)
3. Internet Layer
Function: Determines the best path (routing) for data to travel across networks.
Provides logical addressing (IP addresses).
Ensures that packets move from source to destination across multiple networks.
Examples:
o IP (IPv4 / IPv6): Core addressing & routing protocol
o ICMP: Error reporting (ping, traceroute)
o ARP: Mapping IP to MAC addresses
Data Unit: Packets
4. Network Access Layer (or Link Layer / Host-to-Network Layer)
Function: Defines how data is physically transmitted on the network.
Deals with hardware addressing (MAC), error detection, framing, and physical
transmission.
Combines OSI’s Data Link + Physical layers.
Examples: Ethernet, Wi-Fi (802.11), PPP, DSL, Fiber optics.
Data Unit: Frames → Bits
📊 OSI vs TCP/IP Reference Models
✅ Similarities
No. Similarity
1 Both are based on the concept of layered architecture.
2 Both use a protocol stack with encapsulation & decapsulation.
3 Both provide end-to-end communication.
4 Both have Transport and Application layers (though defined differently).
5 Both separate application-oriented layers from transport-oriented layers.
6 Both define Network layer functions (routing, logical addressing).
7 Both aim for interoperability (working together smoothly)of network devices.
⚡ Differences
No. OSI Model TCP/IP Model
Stands for Transmission Control Protocol /
1 Stands for Open Systems Interconnection
Internet Protocol
2 Developed by ISO (1984) Developed by DoD (1970s)
3 Has 7 layers Has 4 layers (sometimes shown as 5)
Layers: Application, Presentation, Session, Layers: Application, Transport, Internet,
4
Transport, Network, Data Link, Physical Network Access
5 Conceptual/Theoretical model Practical/Implementation model
Designed to standardize networking
6 Designed to make the Internet work
functions
Strict modularity – each layer has distinct
7 Loose modularity – some functions overlap
roles
8 Used mainly for teaching & reference Used for real-world networking
Network layer supports connection- Network layer supports only connectionless
9
oriented & connectionless (IP)
10 Transport layer supports only connection- Transport layer supports both TCP
oriented (connection-oriented) & UDP
No. OSI Model TCP/IP Model
(connectionless)
Services, Interfaces, Protocols are clearly Original model did not clearly separate
11
separated them
Protocols are exposed and fixed (TCP/IP
12 Protocols are hidden and replaceable
family)
Came before protocols, unbiased but
13 Came after protocols, perfectly fits Internet
impractical
Never widely implemented in real Universally implemented (basis of the
14
networks Internet)
15 More complex (7 layers, abstract) Simpler (4 layers, practical)
Protocol-dependent (HTTP, TCP, IP,
16 Protocol-independent
Ethernet)
Session & Presentation layers are
17 Their functions are merged into Application
separate
18 ISO standardized IETF standardized
Provides better generalization (can
19 Specialized for TCP/IP only
describe any stack)
Security functions were later added in Security added later at Application
20
Presentation/Application (SSL/TLS) & Internet (IPSec)