Computer Network Unit 2 (Easy Notes ) Edushine Classes
Computer Network Unit 2 (Easy Notes ) Edushine Classes
Edushine Classes
Follow Us
Download Notes : https://rzp.io/rzp/wshN6Xm
https://telegram.me/rrsimtclasses/
Computer Network (BCS603)
📦 Example:
Imagine 3 computers are connected in a LAN (Local Area Network):
• You (Computer A) want to send a file to Computer B.
• Data Link Layer adds Computer B’s MAC address to the frame.
• It checks for errors and sends it.
• If there's any problem, it asks to resend.
What is Framing?
👉 Framing is a method used in the Data Link Layer of the OSI model to divide the full
message (data) into smaller, manageable units called frames.
Each frame carries:
• A piece of the original data
• Address information (who is sending and who should receive)
• Error checking bits (to detect if anything got changed during transmission)
Frames
Sdfdg
From Sending Machine to Receiving
df Machine using Frames
Let’s Breakdown above diagram to clear understanding
🎯 1. What is a Packet?
At the start, the sending machine (your computer or any device) has data to
send. This data is packaged into a packet by the Network Layer.
👉 Example: You’re sending a message “HELLO” to a friend.
📦 2. What Happens in the Data Link Layer?
The Data Link Layer takes that packet and wraps it into a frame.
Look at the structure of the frame in your diagram:
Types of Framing :
1. Character Count Framing
The first field of the frame tells the number of characters (bytes) in that frame.
🔧 Example:
[06][D][A][T][A][1][2]
🔲 2. Character/Byte Stuffing:
It means inserting a special byte called ESC (Escape character) before any accidental
FLAG that appears in the data.
✅ Why?
To make sure the receiver knows: “Hey, this is not a real FLAG, it’s just part of the
data.”
Escape = ESC
FLAG [Header Payload Trailer] FLAG
End Delimeter End Delimeter
Now,
[7E 41 7D 42 7E 50 70 46 7E]
FLAG FLAG
💻 3. Bit Stuffing
Used in bit-oriented protocols.
A special pattern like 01111110 is used to indicate frame boundaries.
If 5 continuous 1’s appear in data, a 0 is “stuffed” after them to avoid confusion.
Example: ✅ Advantage:
Data: 011111 → Stuff a 0 → 0111110 •Works with all types of data (text,
Final frame: images, files).
[01111110]Data with bit stuffing[01111110] •Very reliable for bit-level
communication.
❌ Disadvantage:
•Adds extra bits, increasing the frame
size.
Error Detection :
1. Single Parity Check Error Correction :
2. Two Dimensional Parity 1. Hamming Code
Check 2. Binary Convolution
3. Checksum 3. Reed Solomon
4. Cyclic redundancy check 4. Low desigty parity check
Sender Receiver
Suppose we want to send this 4-bit data: What does the receiver do?
Data: 1011 Receiver receives: 10111
Count the number of 1s: • It again counts the number of 1s:
1 + 0 + 1 + 1 = 3 (odd number) 1 + 0 + 1 + 1 + 1 = 4 (even)
To make it even, we add a parity bit = 1 ✅ So, data is correct (no error).
So, the data becomes:
Sent: 1 0 111
Received: 1 1 111
Now, count 1s:
1 + 1 + 1 + 1 + 1 = 5 (odd)
❌ So, error is detected.
⚠Important Note:
Single parity can only detect odd number of errors (like 1, 3, 5 errors).
It cannot detect if two bits(Even Bits) are wrong this is the major
disadvantages of this methods.
Now send the full matrix with row and column parity bits.(Data Sent)
3.Checksum
Checksum is a method used to detect errors in data during transmission (like sending
data from sender to receiver).
If the data changes even a little, the summary (checksum) will also change.
️ Basic Steps:
• Divide data into equal-size blocks (usually in 8 bits or 16 bits).
• Add all the blocks together using binary addition.
• Take the 1’s complement of the result (flip all 0s to 1s and 1s to 0s).
• That result is called the checksum.
• Sender sends both data + checksum.
• Receiver adds all data blocks + checksum.
• If the result is all 1s, the data is correct. Otherwise, error detected!
- Download
DownloadNotes
Notes: :https://rzp.io/rzp/wshN6Xm
https://rzp.io/rzp/wshN6Xm
Computer Network (BCS603)
⚠️Limitations:
• Cannot detect all types of errors.
• Not useful for large or very sensitive data.
• Cannot correct errors — only detects them.
✅ CRC generation
• Find length of Divisor (L)
• Append (L-1) bits '0' to original msg
• Perform binary division operation
• Remainder of division = CRC ←
• Transmitted msg = msg bit + CRC ←
CRC is verified at Receiver end:
• Received data is divided by divisor
• If no remainder, the data is correct and accepted.
• Otherwise data is rejected.
Example –
Msg = 100100
Divisor = 1101
Solution
• Find length of Divisor (L) = 4
• Append (L-1) bits '0' to original msg.
• L-1 = 3 (000) append in msg
Now Msg Becomes 100100000
💡 Advantages of CRC:
• Can detect most common errors
• More reliable than parity or simple checksums
• Widely used in network protocols and storage devices
⚠️ Disadvantages:
• It can only detect errors, not fix them
• Slightly more complex than parity/checksum
Q. Find the CRC for data 1101011111 using the divisor x⁴ + x + 1 (V.V.IMP)
Hint -
x⁴ + x3 + x2 + x1 + x0
x4 + x 3 + x 2 + x + 1
1 0 0 1 Download 1( Now 10011 use
Notes previous step and find CRC)
: https://rzp.io/rzp/wshN6Xm
Computer Network (BCS603)
Error Correction :
1. Backward Error Detection
2. Forward error detection
Example –
Msg – 1000001
M=7
Solution :
1. Calculation of redundant bit (2^r > m + r + 1)
r = 4 (redundant bit)
Transmitted Msg = M + r
= 7 + 4 = 11 bit
20 = 1
21 = 2 1 0 0 r 0 0 0 r 1 r r
22 = 4
23 = 8
P1 = r 1 0 0 0 1 = 0 (To make even
3. Calculation of value at redundant bit: 1’s)
P2 = r 1 0 0 0 1 = 0 (To make even
p8 p4 p2 p1 1’s)
P4 = r 0 0 0 = 0 (To make even 1’s)
1 0 0 0
Flow Control :
Flow control is a technique used in the Data Link Layer to make sure that:
👉 The sender does not send data faster than the receiver can process.
If the sender is very fast and the receiver is slow, then the receiver may miss or lose
data. So flow control is important to prevent data loss.
🔹 Simple Example:
Imagine you are filling a water bottle with a tap.
• If the tap is too fast and the bottle is small and slow to fill, the water will overflow.
• The same happens in networking — if sender sends too fast, the receiver overflows.
Advantages:
✔️ Simple to understand and use
✔️ Reliable for error checking
✔️ Ensures correct delivery
Disadvantages:
❌ Slow (only one frame at a time)
❌ Wastes time waiting
❌ Not efficient for long-distance
communication
Computer Network (BCS603)
10 9 8 7 6 5 4 3 2 1 0
📊 Advantages:
• ✅ Saves bandwidth.
• ✅ More efficient than Go-Back-N.
• ✅ Faster transmission when errors are few.
❌ Disadvantages:
• ❌ More complex to implement.
• ❌ Requires more memory/buffers to handle out-of-order frames.
MAC Protocol
✅ Key Points:
i. Turn-based system – Only one device is allowed to send at a time.
ii. No collisions – Since access is controlled, devices don’t interfere.
iii. It is more efficient than Random Access when many devices are present.
iv. Common in LANs (Local Area Networks).
Example:
Soch tu aur tere doston ko teacher ne bola:
"Ek-ek karke apna answer bolo."
Ab sabko apna number milta hai, koi ek time pe bolta hai.
Na koi interfere karta hai, na teacher confuse hoti hai.
Yehi hota hai Controlled Access – sabko turn milta hai, collision nahi hota.
✅ Key Points:
• Bandwidth is divided into channels.
• Each user gets a separate channel, so no interference.
• All users can send data simultaneously.
• Best suited for wireless networks like mobile phones.
Example:
Soch ek sadak hai jahan se log guzarte hain.
Agar sab log ek hi raste se chalein, to bheed ho jaayegi (collision).
To kya kiya jaata hai? Alag-alag lanes bana diye jaate hain — jaise bike lane, car lane,
truck lane.
Bas yahi hota hai Channelization Protocol — har user ko ek alag lane milti hai taaki
sab safe aur smooth travel karein 🛣️.
Example:
Soch ek classroom hai jahan sab
students bina permission ke ek saath
bolte hain.
Agar do ya zyada students ek saath
bolenge, to teacher kuch bhi nahi sun
paayegi — yehi hota hai collision.
Fir teacher bolegi "dobara bolo ek-ek
karke", to bachche random time baad
firse bolte hain.
Yehi hota hai Pure ALOHA ka system.
Computer Network (BCS603)
🔁 Step-by-step :
i. Start
→ The process begins — the device is ready to send data.
ii. Set backoff to zero
→ Backoff time means the waiting time after a collision. Initially,
it's set to 0.
iii. Send the data packet
→ The device sends its data packet to the network.
iv. Wait
→ After sending, the device waits for an acknowledgment (ACK)
from the receiver.
v. Received ACK?
i. If Yes → data is successfully received 🎉 → Success.
ii. If No → that means collision happened 💥.
Download Notes : https://rzp.io/rzp/wshN6Xm
Computer Network (BCS603)
Slotted ALOHA?
Slotted ALOHA is an improved version of Pure ALOHA that reduces the chances of
collision.
👉 Main Idea:
In Slotted ALOHA, time is divided into slots and devices can only send data at the
beginning of a time slot, not anytime they want (like Pure ALOHA).
Slotted ALOHA is a multiple access protocol where the time is divided into fixed-size
slots, and a station can only send data at the beginning of these slots. This helps in
reducing collisions and improving efficiency.
📊 Efficiency:
• Slotted ALOHA Efficiency ≈ 36%
Means out of 100 attempts, around 36 can succeed if all work properly.
❌ Slot 6:
• Another collision!
• Station 3 sends Frame 3.2
• Station 4 sends Frame 4.2
• Both sent in the same slot → ❌ Collision
Important Point:
• In Slotted ALOHA, if two or more stations choose the same slot, collision will
happen, and both data frames will be lost.
• If only one station uses a slot → the data is sent successfully.
Sense Career
Sense Career
YES
Wait random
YES Busy time
NO
Msg transmit
6. If No Collision:
The data is successfully transmitted.
The process ends.
7. If Collision Detected:
The device sends a JAM signal to inform all devices about the collision.
This helps other devices know that the data was not transmitted successfully.
8. Check Retry Limit:
If retry limit is not reached, the device waits for a random backoff time (this prevents
repeated collision), and then tries again.
If retry limit is exceeded, the device stops trying and gives up the transmission.
✅ Advantages:
• Network pe collision detect ho jaata hai
• Wired medium ke liye best hai
• Bandwidth waste hone se bachti hai
❌ Disadvantages:
• Wireless networks mein use nahi ho sakta
(kyunki wireless mein hum detect nahi kar paate easily ke kisi aur ka data aa raha hai)
• High traffic mein still delays ho sakte hain
📘 Real-life Example:
Imagine a group of students in a classroom:
• A student wants to speak (send data).
• He first checks if the teacher (channel) is listening.
• Before speaking, he raises his hand (RTS).
• If the teacher gives permission (CTS), he speaks.
• After he finishes, the teacher says "okay" (ACK).
🔷 How It Works:
• Uses CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
• Devices check if the cable is free
• If free → send data
• If two devices send together → collision happens
• Devices wait random time and try again
🔷 Characteristics:
• Speed: 10 Mbps to 10 Gbps or more
• Cable: Twisted Pair, Coaxial, Fiber Optic
• Topology: Star / Bus
• Very reliable and low-latency
✅ Real-World Example:
Used in offices, schools, data centers where high-speed internet and security are
important.
🔷 Characteristics:
• No cables, more flexibility
• Limited range
• Used in homes, cafes, colleges, etc.
✅ Real-World Example:
Your mobile, laptop, or smart TV connected to your Wi-Fi router – that’s 802.11 in
action.
✅ Real-World Example:
Think of it like a group discussion where only the person holding the mic can speak.
Used in old banking networks, but now replaced by Ethernet.
✅ 4. IEEE 802.4 – Token Bus
Token Bus is similar to Token Ring but uses a bus topology instead of a ring.
🔷 How It Works:
• Devices connected in a bus (single main cable)
• A token is passed logically (not physically)
• Only the device with the token can transmit
🔷 Characteristics:
• Used in industrial control systems
• Prevents collision like Token Ring
• Slower adoption in modern networks
Download Notes : https://rzp.io/rzp/wshN6Xm
Computer Network (BCS603)
✅ Real-World Example:
Factory automation systems use Token Bus where timing is important and communication
must be well-organized.
✅ 5. IEEE 802.1 – LAN Management Standard
This standard doesn’t define how devices send data, but how to manage and control the
network.
🔷 Features of IEEE 802.1:
• VLAN (Virtual LANs): Divide one network into small virtual parts
• Spanning Tree Protocol (STP): Prevent looping in switches
• Network security protocols
• Bridging and routing between LANs
✅ Real-World Example:
Big companies use VLANs to separate departments like HR, IT, and Finance, even if they
are using the same network cables.
🔁 Bridge –
A bridge is a network device used to connect two or more LAN segments and make them
work as a single network. It filters data and forwards only necessary traffic to the correct
segment.
Example -
Soch lo do alag-alag classrooms hain, aur dono mein students hain (devices).
Bridge ek teacher hai jo sirf un messages ko dusre class mein bhejta hai jo zaroori hote
hain.
• Agar Class A ka student Class B ke student ko message bhejna chahta hai, to bridge
check karega aur sirf wohi message dusri class mein forward karega.
🛠️ Features of Bridge:
• Works at Data Link Layer (Layer 2).
• Uses MAC addresses to forward data.
Download Notes : https://rzp.io/rzp/wshN6Xm
Computer Network (BCS603)
Thank You…