Session Layer (Layer 5) – OSI Model
1. Definition
- The Session Layer is the 5th layer of the OSI model.
- It is responsible for establishing, maintaining, and terminating sessions between two communicating hosts.
- A session is a continuous exchange of information between two applications.
2. Functions of Session Layer
- Session Establishment – Initiates a session between sender and receiver.
- Session Maintenance – Maintains the session during data transfer.
- Session Termination – Ends the session once communication is complete.
- Synchronization – Adds checkpoints or recovery points in long data streams to resume from failure points.
- Dialog Control – Manages which device transmits when; supports half-duplex and full-duplex communication.
- Session Recovery – Allows interrupted sessions to resume from the last checkpoint instead of restarting.
3. Protocols of Session Layer
- NetBIOS – Used in Windows networks for session-level communication.
- RPC (Remote Procedure Call) – Enables remote function execution.
- ASP (AppleTalk Session Protocol) – Used in older Apple networks.
- SQL Session Control – Manages database session connections.
4. Real-life Examples
- Logging into a website starts a session; logging out or timeout ends it.
- A Zoom or Skype call involves session initiation, maintenance, and termination.
- In online banking, user activities are tracked within a session.
5. Comparison with Adjacent Layers
- Transport Layer (Layer 4) – Handles data transport, flow control, and reliability (e.g., TCP/UDP).
- Session Layer (Layer 5) – Manages sessions and communication flow.
- Presentation Layer (Layer 6) – Deals with data formatting, encryption, and compression.
6. Advantages
- Allows structured and organized communication.
- Enables session recovery using checkpoints.
- Provides dialog control and data synchronization.
7. Disadvantages
- Adds overhead and complexity.
- Rarely implemented separately in modern protocols.
- Functionality often merged into transport or application layers.
REAL-TIME TRANSPORT PROTOCOL (RTP)
Definition
-
RTP is a protocol designed for delivering real-time audio and video over IP networks.
-
It operates at the application layer but is often paired with UDP at the transport layer.
-
RTP is responsible for packet sequencing and time-stamping to ensure real-time data integrity.
Features
-
Supports sequence numbering to detect packet loss and ensure correct packet order.
-
Uses timestamps to synchronize audio/video playback.
-
Payload type field identifies the format of the encoded media.
-
SSRC field uniquely identifies the source of the stream.
-
Can be used with RTCP to monitor delivery and provide feedback.
Use Cases
-
Internet telephony (VoIP applications like Skype, WhatsApp).
-
Video conferencing platforms such as Zoom, Google Meet.
-
Live media broadcasting (YouTube Live, Twitch).
-
Real-time sensor data streaming in IoT or surveillance.
Examples
-
A Zoom meeting uses RTP to transmit voice and video streams simultaneously.
-
IP camera footage streamed live to a security center uses RTP over UDP.
RTP SESSION LAYER
Definition
-
RTP sessions are logical groupings of RTP packet streams exchanged between participants.
-
Each session is identified by a pair of IP addresses and port numbers.
-
RTP behaves like a session-layer protocol by organizing multiple media streams and maintaining sync.
Structure
-
Each media type (audio, video) can be carried in a separate RTP session.
-
Sessions are defined by SSRCs that identify synchronization sources.
-
Contributing sources (CSRCs) identify members in a mixed stream (e.g., audio mixing).
-
RTCP works in parallel, sharing stats like packet loss, jitter, and latency.
Use Cases
-
A video call that separates audio, camera feed, and screen share into three RTP sessions.
-
E-learning platforms where different media components are streamed as separate sessions.
Examples
-
SIP-based VoIP services initiate RTP sessions for audio and video media after session negotiation.
-
In live-streaming, the audio and video data may be sent through separate RTP sessions and synchronized on the client side.
TOKEN CONCEPT
Definition
-
A token is a control mechanism used to manage access to shared resources or sessions.
-
In networking, it ensures orderly and collision-free transmission.
-
In authentication, a token represents user identity and session privileges.
Networking Context
-
In Token Ring, a token circulates and only the holder can transmit data.
-
Token Bus forms a logical ring on a physical bus; token is passed sequentially.
-
Ensures fair access and avoids simultaneous transmissions.
-
Often used in deterministic environments like factory automation.
Session/Authentication Context
-
In web systems, a token is issued after login to maintain session state (e.g., JWT).
-
Token-based sessions are stateless; each request contains the token for authentication.
-
Improves security by avoiding password reuse and simplifies horizontal scaling.
Use Cases
-
Token Ring and Token Bus networks in industrial automation for real-time data.
-
OAuth and JWT tokens in APIs to manage user access securely.
-
Multiplayer turn-based games where a logical token controls player actions.
Examples
-
An IBM Token Ring LAN where devices take turns transmitting based on token possession.
-
A user logs in to a web app and receives a JWT token used for all subsequent API requests.