Computer Networks
CN Part-1
- What is a Computer Network?
- Goals and Applications of Computer Networking
- Computer Network Components
- Types of Computer Networks
- Network Topology
- Difference between Client Server and Peer to Peer Network
- Layered Architecture in Computer Networks
- Protocol Hierarchy in Computer Networks
- Interfaces and Services in Computer Networks
- Connection Oriented and Connectionless Services
- Service Primitives
- OSI Model
- TCP/IP Model
- Difference between OSI Model and TCP/IP Model
- Encapsulation and Decapsulation in Computer Networks
- Queueing Models in Computer Network
CN Part-2
Error Detection and Correction in Computer Networks
Error Detection and Correction kya hota hai?
Jab bhi data network ke through bheja jata hai (sender se receiver tak), to noise, disturbance ya hardware issues ki wajah se data corrupt ho sakta hai.
Isiliye humein zarurat hoti hai aise techniques ki jo:
Error detect kar sakein (galti hui ya nahi)
Error correct bhi kar sakein (agar ho sake)
Communication ko reliable aur sahi bana saken
Error Detection aur Correction ke Goals
Data agar galat gaya hai to pakadna (detect karna)
Agar possible ho to galti sudharna (correct karna)
Agar nahi sudhar sakte to dubara bhejne ke liye kehna
Errors ke Types
Type of Error | Example |
---|---|
Single-bit error | Sirf ek bit galat ho gaya – 1010 → 1110 |
Burst error | Ek se zyada bits galat ho gayi – 10110011 → 10011101 |
Error Detection Techniques
Ye methods ye batate hain ki data transmission ke time koi galti (error) hui hai ya nahi.
Ye sirf error detect karte hain, correct nahi karte.
1. Parity Bit
Kya hota hai?
Ek extra bit data ke saath bheji jaati hai — jise parity bit kehte hain.
Ye decide karti hai ki total 1s even (samaan) ya odd (visham) hone chahiye.
Types:
Even Parity: Total number of 1s (including parity bit) even hone chahiye.
Odd Parity: Total number of 1s odd hone chahiye.
Example:
Data = 1010001
→ 1s = 3 (odd) → Even parity chahiye → Add parity bit = 1
Final data = 10100011
Receiver count karega 1s → Agar even nahi hua to error detect ho jayega.
Limitations:
Sirf single-bit error detect karta hai.
Agar 2 bits galat ho jaayein to miss ho sakta hai.
2. Checksum
Kya hota hai?
Data ko parts me divide karte hain (jaise 4-bit blocks).
In blocks ka binary addition karte hain.
Uska 1’s complement lete hain → ye hota hai checksum.
Receiver fir wahi addition karta hai. Agar result all 1s hua → no error.
Example:
Word 1: 1100
Word 2: 1010
Sum = 1100 + 1010 = 10110
Last 4 bits = 0110
1's complement = 1001 → Ye hai checksum
Receiver bhi yehi karega. Agar final result 1111
(all 1s) nahi aaya → error.
Limitation:
Thoda better hai parity se.
Lekin complex ya burst errors detect nahi karta accurately.
3. CRC (Cyclic Redundancy Check)
Kya hota hai?
Ek polynomial (binary divisor) lete hain.
Data ko us divisor se divide karte hain → remainder aata hai → wo hota hai CRC code.
Sender data + CRC bhejta hai.
Receiver dobara division karta hai. Agar remainder
0
nahi aaya → error hai.
Real-life Example:
Data: 11010011101100
Generator: 1011
(Actual calculation thoda lamba hota hai — alag se step-by-step diya ja sakta hai.)
Advantages:
Burst errors bhi detect kar leta hai.
Wi-Fi, Ethernet, USB sab mein use hota hai.
Limitation:
Error correct nahi kar sakta.
Calculation thoda complex hota hai.
Error Correction Techniques
Ye methods na sirf error detect karte hain, balki galti sudhar bhi sakte hain (ya resend mangwate hain).
1. Hamming Code
Kya hota hai?
Isme multiple parity bits data ke saath bheji jaati hain.
In parity bits se pata chalta hai ki kaunsa bit galat gaya.
Fir us bit ko flip karke correct kar sakte hain.
Kam Kese Karta Hai?
Total bits = Data bits + Parity bits
Positions of parity bits: Powers of 2 (1, 2, 4, 8, …)
Each parity bit checks certain bits
Example:
Data: 1011
Add 3 parity bits → Transmitted code = 0110011
(specific positions me bits)
Agar transmission ke time ek bit flip ho gayi to parity bits uska position detect karke usse theek kar dengi.
Advantages:
Single-bit error ko detect aur correct karta hai.
Simple networks me kaafi useful hai.
Limitation:
Multiple bit errors ke liye kaafi nahi.
Extra bits lagti hain.
2. ARQ (Automatic Repeat Request)
Ye method error detect karta hai, aur agar data galat gaya ho to sender ko dubara data bhejne ke liye bolta hai.
a) Stop-and-Wait ARQ
Ek frame bhejo → Wait for ACK (sahi) ya NACK (galat)
Agar NACK aaya ya reply nahi aaya → same frame dobara bhejna
Diagram:
Sender → Frame 1 → Receiver
Receiver → ACK → Sender
Sender → Frame 2 → Receiver
Receiver → NACK → Sender
Sender → Frame 2 again
b) Go-Back-N ARQ
Sender multiple frames bhejta hai.
Agar ek galat mil gaya to uske baad ke sab frames discard ho jaate hain.
Sender un sabko dobara bhejta hai.
c) Selective Repeat ARQ
Sender multiple frames bhejta hai.
Receiver sirf galat frame ko dobara maangta hai.
Baki sahi frames save kar leta hai.
Comparison Table
Method | Detects Error | Corrects Error | Best Use Case |
---|---|---|---|
Parity Bit | Yes | No | Simple & fast |
Checksum | Yes | No | Large data blocks |
CRC | Yes | No | Burst errors (network protocols) |
Hamming Code | Yes | Yes (1-bit) | Single-bit correction |
ARQ | Yes | Yes (via resend) | TCP/IP networks (like internet) |
Real-Life Example:
Courier Example:
Aapne ek fragile parcel bheja
Agar damage ho gaya to receiver complain karega (error detection)
Aap firse bhejoge ya repair milega (correction)
Agar chhoti si damage hai to receiver khud theek kar leta hai (like Hamming)
Conclusion
Error detection batata hai ki data galat gaya hai ya nahi
Error correction ya to data sahi kar deta hai ya usse dobara mangta hai
Har network system mein ye techniques essential hain, especially real-time aur reliable communication ke liye