Unit 2: Computer Networks (Class 12 Computer Science)
Definition:
A computer network is a system where multiple computing devices are connected to share
resources, data,
and applications. These interconnected devices communicate using defined protocols.
Key Topics:
1. Types of Networks
- LAN (Local Area Network): Small geographical area, high-speed (e.g., Office networks).
- WAN (Wide Area Network): Covers large areas, slower than LAN (e.g., Internet).
- MAN (Metropolitan Area Network): Intermediate range, spans a city (e.g., Cable TV network).
2. Network Devices
- Switch: Connects devices in a network and uses MAC addresses to forward data.
- Router: Connects different networks and routes data packets.
- Hub: Basic device broadcasting data to all devices.
- Modem: Converts digital signals to analog for phone lines and vice versa.
- Access Point: Extends a wireless network.
3. Network Protocols
- HTTP: For web communication.
- FTP: Used for file transfer.
- SMTP: Sending emails.
- TCP/IP: Foundation of internet communication.
4. Network Topologies
- Bus: All devices connected to a single cable.
- Star: Devices connected to a central hub.
- Ring: Devices form a circular chain.
- Mesh: Every device interconnected.
- Hybrid: Combination of topologies.
5. IP Addressing
- IPv4: 32-bit addressing (e.g., [Link]).
- IPv6: 128-bit addressing.
- Types: Public/Private IP, Static/Dynamic IP.
6. Cybersecurity
- Threats: Phishing, Malware, Ransomware, Hacking.
- Measures: Firewalls, antivirus software, strong passwords, 2FA.
Python in Networking:
Python can be used for scripting, testing, and creating network tools.
Example Code: Simple HTTP Server
```python
from [Link] import HTTPServer, SimpleHTTPRequestHandler
host = "localhost"
port = 8080
server = HTTPServer((host, port), SimpleHTTPRequestHandler)
print(f"Server started at [Link]
server.serve_forever()
```
Practice Questions
Theory Questions:
1. Define a computer network. What are its advantages?
2. Explain the differences between LAN, MAN, and WAN.
3. Describe three network topologies with diagrams.
4. What is the difference between a switch and a router?
5. List and explain five common network protocols.
Python-Based Questions:
1. Write a Python script to demonstrate simple client-server communication using the `socket`
module.
2. Create a Python program to check if a given IP address is valid.
3. Explain how Python's `[Link]` module is used in networking.