Application layer

The Application Layer is the top layer of the OSI model and the TCP/IP model. It’s the layer that directly interacts with the end-user’s applications to provide network services to those applications. Think of it as the interface between the software you use (like your web browser, email client, or file transfer program) and the underlying network.

Main Functions of Application Layer:

  1. Network Virtual Terminal:
    • Allows a user to log on to a remote host (like Telnet).
  2. File Transfer, Access & Management (FTAM):
    • Supports file uploading, downloading, access, and management across the network.
  3. Email Services:
    • Provides email forwarding, storage, and management (using protocols like SMTP, POP3, IMAP).
  4. Directory Services:
    • Provides access to global directory information (such as DNS, LDAP).
  5. Data Exchange:
    • Facilitates data exchange services between applications (e.g., HTTP for web browsing).
  6. Remote Resource Sharing:
    • Accessing printers, files, and other resources on remote machines. (Application layer)

Examples of Application Layer Protocols:

  • HTTP (HyperText Transfer Protocol) – Web Browsing
  • SMTP (Simple Mail Transfer Protocol) – Email Sending
  • FTP (File Transfer Protocol) – File Transfer
  • DNS (Domain Name System) – Domain Name Resolution
  • SNMP (Simple Network Management Protocol) – Network Management
  • Telnet – Remote Login

Application layer Introduction to Error Detection and Correction

In data communication, errors may occur during transmission due to noise, interference, or signal distortion.Error Detection and Correction techniques are used to identify and fix these errors to ensure accurate data delivery. (Application layer)

Types of Errors:

Single-bit Error:

  • Only one bit is changed(flipped from 0 to 1 or 1 to 0).
  • Rare in noisy environments.

Example:
Original Data: 10110010
Received Data: 10110000
(Only one bit is wrong)


Burst Error:

  • Two or more bits in a data unit are altered.
  • The length of the burst error is the distance between the first and last corrupted bit.
  • Common in real communication channels. (Application layer)

Example:
Original Data: 10110010
Received Data: 10011110
(Multiple bits are wrong in a sequence)


Redundancy:

Adding extra bits (redundant bits) to the original data to help detect or correct errors.

  • These extra bits carry no original information but help in detecting and correcting errors.
  • Redundancy is the basis of error detection & correction techniques.

Detection vs Correction:

AspectError DetectionError Correction
PurposeIdentify if an error has occurred during transmission.Identify and correct the error without retransmission.
Methods UsedParity Bits, Checksums, CRCHamming Code, Reed-Solomon, Forward Error Correction
Action TakenRequests retransmission of the corrupted data.Corrects errors at the receiver side itself.
ComplexitySimple to implementMore complex and requires extra redundancy

Cyclic Redundancy Check (CRC)

CRC is an error-detection technique used to detect accidental changes to raw data in digital networks and storage devices by adding redundant bits (called CRC bits) to the data. (Application layer)

How CRC Works:

  1. Sender Side:
    • Data bits are treated as a binary number.
    • A predefined divisor is used.
    • Data is divided by this divisor using binary division.
    • The remainder is appended to the data.
    • This entire frame (data + CRC bits) is sent.
  2. Receiver Side:
    • The receiver divides the received frame by the same divisor.
    • If the remainder is zero, the data is considered error-free.
    • If not, an error is detected. (Application layer)

Key Points:

  • CRC is based on polynomial division.
  • It is highly reliable for detecting burst errors.
  • No correction, only detection.

Advantages of CRC:

  • Simple and efficient.
  • Excellent error detection capability.
  • Suitable for detecting common errors in transmission.

Applications of CRC:

  • Ethernet networks.
  • Data storage devices (hard disks, CDs, DVDs).
  • Wireless communication protocols. (Application layer)

Hamming code and related numerica

Hamming Code

Definition:

Hamming Code is an error detection and correction technique that can detect up to two-bit errors and correct single-bit errors in transmitted data by using redundant parity bits.

It ensures reliable communication in noisy environments.


Features:

  • Detects 2-bit errors.
  • Corrects 1-bit error.
  • Uses parity bits for error checking.
  • Based on binary positions of bits.

Steps for Hamming Code Generation:

1. Calculate the number of parity bits (r):

  • Formula: 2^r ≥ m + r + 1
    Where:
    m = number of data bits
    r = number of redundant parity bits

Example: For 4 data bits,
Try r = 3
2^3 = 8 ≥ 4 + 3 + 1 = 8
Hence, 3 parity bits are required.


2. Arrange data and parity bits in correct positions:

  • Parity bits are placed at positions 1, 2, 4, 8, etc. (powers of 2)
  • Data bits are placed in remaining positions. (Application layer)
Application layer

Example:
For data bits = 1 0 1 1
Positions are filled as:
Position 1: P1 (parity bit)
Position 2: P2 (parity bit)
Position 3: D1 (data bit = 1)
Position 4: P3 (parity bit)
Position 5: D2 (data bit = 0)
Position 6: D3 (data bit = 1)
Position 7: D4 (data bit = 1)

So, initial arrangement: _ _ 1 _ 0 1 1


3. Calculate parity bits:

  • Each parity bit covers specific positions.
  • Use even parity (or odd parity if specified).

Calculation:

  • P1 covers positions: 1, 3, 5, 7
    Bits: 3(1), 5(0), 7(1)
    XOR operation: 1 XOR 0 XOR 1 = 0
    So, P1 = 0
  • P2 covers positions: 2, 3, 6, 7
    Bits: 3(1), 6(1), 7(1)
    XOR operation: 1 XOR 1 XOR 1 = 1
    So, P2 = 1
  • P3 covers positions: 4, 5, 6, 7
    Bits: 5(0), 6(1), 7(1)
    XOR operation: 0 XOR 1 XOR 1 = 0
    So, P3 = 0

4. Final Hamming Code:

Substitute the calculated parity bits back into positions. (Application layer)

Position 1: P1 = 0
Position 2: P2 = 1
Position 3: D1 = 1
Position 4: P3 = 0
Position 5: D2 = 0
Position 6: D3 = 1
Position 7: D4 = 1

Final transmitted code: 0 1 1 0 0 1 1


Final Answer:

The Hamming code is 0110011.


Applications of Hamming Code:

  • Computer memory (RAM) error correction.
  • Satellite communication.
  • Digital data transmission.
  • Wireless networks. (Application layer)

Framing

Framing is a method used in the Data Link Layer to divide a data stream into frames, making it easier for the receiver to identify the beginning and end of data packets. (Application layer)


Purpose of Framing

  • To mark start and end of data
  • Helps in synchronization
  • Supports error detection and correction (Application layer)

Methods of Framing

  1. Length Count
  2. Character-Oriented Framing
  3. Bit-Oriented Framing
  4. Byte Stuffing
  5. Bit Stuffing

Character-Oriented Protocols

Definition: Protocols that use special character codes (like ASCII) for marking frame boundaries and control information. (Application layer)

Features:

  • Uses SOH (Start of Header), EOT (End of Transmission)
  • Simple to use for text data
  • Needs character stuffing if control characters appear in actual data

Example: BISYNC Protocol

Disadvantage: Not effective for binary data transmission


Bit-Oriented Protocols

Definition: Protocols that treat the data as a stream of bits and use special bit patterns to define frame boundaries. (Application layer)

Features:

  • Uses flag sequence (example: 01111110)
  • Suitable for both binary and text data
  • Bit stuffing used to avoid confusion when flag pattern appears in data

Example: HDLC (High-Level Data Link Control)


Difference between Character-Oriented and Bit-Oriented Protocols

Character-Oriented Protocols:

  • Use characters as delimiters
  • Require character stuffing
  • Ideal for text data
  • Example: BISYNC

Bit-Oriented Protocols:

Example: HDLC

Use bit patterns as delimiters

Require bit stuffing

Suitable for binary and text data

Simplex and Stop & Wait Protocols, Sliding window protocols

Simplex Protocol

  • Data flows in only one direction (from sender to receiver).
  • The receiver cannot send data back to the sender.
  • Used in cases like keyboard to monitor or TV broadcast.
  • Simple but no error control or acknowledgments from receiver.

Stop-and-Wait Protocol

  • Sender sends one frame and waits for an acknowledgment (ACK) before sending the next frame.
  • Ensures reliable delivery with error checking and retransmission if needed.
  • Simple but inefficient for long delays or high-speed links because sender waits idle for ACK.
  • Suitable for low-speed or reliable links. (Application layer)

Sliding Window Protocol

  • Allows the sender to send multiple frames before needing an acknowledgment, improving efficiency.
  • Uses a “window” of frame sequence numbers to control flow.
  • The window size defines how many frames can be sent without ACK.
  • Receiver can accept frames and send cumulative acknowledgments.
  • Types:
    • Go-Back-N (sender retransmits from erroneous frame onward)
    • Selective Repeat (only erroneous frames are retransmitted)

Multiple access protocols: ALOHA, CSMA,CSMA/CD, CSMA/CA

Multiple Access Protocols

These protocols manage how multiple devices share a common communication medium to avoid collisions.


ALOHA

  • Simple protocol for wireless networks.
  • Devices send whenever they have data (unslotted ALOHA).
  • If collision occurs, devices wait a random time and resend.
  • Efficiency is low (~18% for pure ALOHA).
  • Slotted ALOHA improves efficiency (~37%) by dividing time into slots.

CSMA (Carrier Sense Multiple Access)

  • Devices check if the medium is free before transmitting.
  • If busy, they wait and try later.
  • Reduces collisions compared to ALOHA.
  • No collision detection, so collisions can still happen.

CSMA/CD (Carrier Sense Multiple Access with Collision Detection)

  • Used in wired Ethernet networks.
  • Devices listen to the medium while transmitting.
  • If a collision is detected, they stop transmitting immediately.
  • Then, wait a random time before retransmitting.
  • Improves efficiency by reducing wasted time.

CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)

  • Used in wireless networks (like Wi-Fi).
  • Since collision detection is hard in wireless, devices try to avoid collisions before transmission.
  • Uses acknowledgments and waiting times to reduce collision chances.
  • Employs RTS/CTS (Request to Send / Clear to Send) handshake to reserve the channel.

Function of Network layer , IPv4 ADDRESSES: Address Space, Notations: Binary Notation and Dotted-Decimal Notation

Function of Network Layer

  • Responsible for routing packets from source to destination across multiple networks.
  • Provides logical addressing (IP addressing) to identify devices uniquely.
  • Handles packet forwarding, including routing through intermediate routers.
  • Manages of packets if needed.
  • Controls congestion and error handling in some implementations.
  • Ensures end-to-end delivery of data.

IPv4 Addresses

IPv4 is a 32-bit address used to uniquely identify devices on a network.


Address Space

  • IPv4 addresses are 32 bits long, allowing for about 4.3 billion unique addresses (2^32).
  • Divided into network and host portions for routing.
  • Address space is divided into classes (A, B, C, D, E) based on leading bits.

Notations

Binary Notation

  • IPv4 addresses are represented as 32 bits (e.g., 11000000 10101000 00000001 00000001).
  • Each bit can be 0 or 1.

Dotted-Decimal Notation

  • The 32 bits are divided into four 8-bit groups called octets.
  • Each octet is converted to decimal and separated by dots.
  • Example: 192.168.1.1

Also Read :- Network and Transport layer | B.Tech 2nd Year Exam

Similar Posts