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
Framing in Data Link Layer
Framing kya hota hai?
Framing ek process hai jisme Data Link Layer ek continuous bit stream ko chhote-chhote meaningful parts (frames) mein divide karta hai taaki data easily transmit ho sake.
Socho aap ek lambi baat bol rahe ho bina rukhe — koi samjhega hi nahi. Agar aap usse sentences mein divide karo, to baat samajhna easy ho jaata hai.
Waise hi framing se computer data ko samajh pata hai — “Yeh part ek message hai, ab dusra shuru ho raha hai.”
OSI Model mein Framing ka place
Framing hoti hai OSI Model ke Layer 2: Data Link Layer mein.
7. Application
6. Presentation
5. Session
4. Transport
3. Network
-> 2. Data Link ← Framing yahan hota hai
1. Physical
Frame Structure
Har frame 3 main parts mein divided hoti hai:
| Header | Payload (Data) | Trailer |
-
Header → Source aur Destination MAC Address, control info
-
Payload → Actual data jo bhejna hai
-
Trailer → Error detection ke liye (CRC etc.)
Framing ke Purpose
-
Data ko manageable blocks (frames) mein todna
-
Frame ke start aur end identify karna
-
Sender aur receiver ki pehchaan (MAC address se)
-
Errors detect karna (Trailer ke through)
-
Network mein data transmission reliable banana
Types of Framing
Framing ke 2 main types hote hain:
1. Fixed Size Framing
-
Isme har frame ka size same hota hai (e.g., 1000 bytes)
-
Frame boundaries samajhne ke liye extra information ki zarurat nahi hoti
-
Sirf data stream ko equal parts mein divide kar dete hain
Example:
1000 bytes | 1000 bytes | 1000 bytes | ...
Simple to implement
Agar data short ho ya jyada ho to space waste ya overflow ho sakta hai
2. Variable Size Framing
-
Isme frames ka size alag-alag ho sakta hai
-
Frame ke start & end dikhane ke liye special technique use karte hain
Variable Framing ke Techniques:
a) Character Count
-
Frame ka pehla byte batata hai ki frame mein total kitne bytes hain
-
Receiver utne bytes read karke frame identify karta hai
Example:
[08][D][A][T][A][_][F][R][M]
↑
8 bytes ka frame
-> Simple
->Agar count galat ho gaya to poora frame corrupt ho sakta hai
b) Byte Stuffing
-
Start & end ke liye ek special flag byte use hota hai (e.g.,
01111110) -
Agar data mein flag byte aa jaye, to uske pehle ESC (escape character) insert karte hain
Example:
[Flag][Data1][ESC][Flag][Data2][Flag]
-> Clear boundaries
-> Extra bytes add hone se overhead badhta hai
c) Bit Stuffing
-
Flag ke liye special bit pattern use karte hain (e.g.,
01111110) -
Agar data mein 5 consecutive 1s aate hain, to ek 0 automatically insert kar dete hain
Example:
Data: 011111 → Stuffed: 0111110
-> Efficient for bit-level data
-> Bit-level processing thoda complex hota hai
d) Physical Layer Coding Violation
-
Physical layer ke illegal signals use karte hain start/end dikhane ke liye
-
Mainly high-speed networks mein use hota hai
-> Very accurate
-> Specific hardware support chahiye
e) Length Field in Header
-
Frame ke header mein ek length field hoti hai
-
Receiver us value ke according frame ka end samajh leta hai
-> Flexible
-> Agar length corrupt ho gaya to frame galat read hoga
Fixed vs Variable Framing
| Feature | Fixed Size Framing | Variable Size Framing |
|---|---|---|
| Frame Size | Har frame same size ka hota hai | Har frame ka size alag ho sakta hai |
| Complexity | Simple | Thoda complex |
| Extra Control Info | Nahi chahiye | Zaroori hoti hai (flag/length etc.) |
| Flexibility | Kam | Zyada |
| Example Use | High-speed, uniform data | Most real-world protocols |
Real-Life Analogy
1. Fixed Size
Jaise ek bus mein har seat ka size same hota hai, chahe passenger mota ho ya patla — seat size change nahi hoti.
2. Variable Size
Jaise ek courier company alag-alag size ke boxes use karti hai — chhoti cheez ke liye chhota box, badi ke liye bada box.
Framing kis protocols mein use hota hai?
-
Ethernet → Bit stuffing
-
PPP (Point-to-Point Protocol) → Byte stuffing
-
HDLC → Flag-based + bit stuffing
-
Wi-Fi → Frame-based transfer
Quick Summary Table
| Point | Explanation |
|---|---|
| Layer | Data Link Layer (Layer 2) |
| Purpose | Bit stream ko frames mein divide karna |
| Types of Framing | Fixed Size & Variable Size |
| Frame Parts | Header, Data, Trailer |
| Techniques Used | Character Count, Byte/Bit Stuffing, Length, Violation |
| Real-Life Example | Parcel packing, Train coaches |
| Protocols | Ethernet, PPP, HDLC, Wi-Fi |
Conclusion
Framing ek essential concept hai jo data ko clear blocks mein divide karta hai.
Yeh ensure karta hai ki:
-
Data accurately transmit ho
-
Receiver ko pata chale data kaha start aur end hota hai
-
Error detect kiya ja sake
Fixed-size framing simple hoti hai lekin flexible nahi, jabki variable-size framing zyada adaptable hoti hai aur real-world networking mein zyada use hoti hai.