Free tutorials & notes in Hindi & English · Clean code examples 🧰 Free PDF & Image Tools →
🌐 Unit 2 – Computer Networks  ·  Lesson 18

Protocols, IP, DNS & Web

What is a protocol?

A protocol is a set of rules that devices follow to communicate – the format of data, how to start and end, and how to handle errors. Like grammar for a language, both sides must follow the same protocol.

Common protocols

ProtocolFull formUsed for
HTTP / HTTPSHyperText Transfer Protocol (Secure)Web pages
FTPFile Transfer ProtocolUploading / downloading files
SMTPSimple Mail Transfer ProtocolSending email
POP3 / IMAPPost Office Protocol 3 / Internet Message Access ProtocolReceiving email
TCP/IPTransmission Control Protocol / Internet ProtocolBasic Internet communication
PPPPoint-to-Point ProtocolDirect link between two devices (dial-up)
TELNETTeletype NetworkRemote login (text, not secure)
VoIPVoice over Internet ProtocolVoice calls over the Internet (WhatsApp call)

TCP/IP

TCP breaks a message into packets, numbers them, checks for errors and reassembles them at the destination. IP puts the source and destination addresses on each packet and routes it across networks.

Your browserWeb serverTCP handshake (SYN)SYN-ACKHTTP GET /index.html200 OK + page (packets)
Opening a web page over TCP/IP

IP address

An IP address is a unique logical address for every device on a network. IPv4 uses 32 bits written as four numbers 0–255 (192.168.1.10). Because IPv4 addresses are running out, IPv6 uses 128 bits (2001:db8::1).

Python
def valid_ipv4(ip):
    parts = ip.split('.')
    if len(parts) != 4:
        return False
    for p in parts:
        if not p.isdigit() or not 0 <= int(p) <= 255:
            return False
    return True
for ip in ['192.168.1.10', '256.10.1.1', '10.0.0', '8.8.8.8']:
    print(ip.ljust(14), valid_ipv4(ip))
192.168.1.10 True 256.10.1.1 False 10.0.0 False 8.8.8.8 True
Python
ip = '192.168.1.10'
print('Binary:', '.'.join(format(int(x), '08b') for x in ip.split('.')))
print('IPv4 has', 2 ** 32, 'addresses; IPv6 has 2**128')
Binary: 11000000.10101000.00000001.00001010 IPv4 has 4294967296 addresses; IPv6 has 2**128

MAC vs IP address

MAC address

  • Physical address burned into the NIC
  • 48 bits, e.g. 00:1A:2B:3C:4D:5E
  • Never changes
  • Used inside a LAN (by switches)

IP address

  • Logical address given by the network
  • IPv4 32 bits / IPv6 128 bits
  • Can change when you change network
  • Used across networks (by routers)

Domain Name System (DNS)

People remember names, computers use numbers. DNS servers convert a domain name into its IP address. Domains have levels: .in, .com, .org, .gov.in are top-level domains.

Type codingeasily.inAsk DNS serverGet IP addressConnect to server
What happens when you type a website name

URL and its parts

A URL (Uniform Resource Locator) is the complete address of a resource on the web.

Python
from urllib.parse import urlparse
u = urlparse('https://www.codingeasily.in:443/tutorial/class-12-cs/stack?lang=hi#push')
print('Protocol :', u.scheme)
print('Domain   :', u.hostname)
print('Port     :', u.port)
print('Path     :', u.path)
print('Query    :', u.query)
print('Fragment :', u.fragment)
Protocol : https Domain : www.codingeasily.in Port : 443 Path : /tutorial/class-12-cs/stack Query : lang=hi Fragment : push

WWW, websites and web servers

  • WWW – the system of linked web pages on the Internet, invented by Tim Berners-Lee (1990). The Internet is the network; the web is one service on it.
  • Web page – a document written in HTML; website – a group of related pages under one domain.
  • Static pages show the same content to everyone; dynamic pages are generated by programs (PHP, Python) and change per user.
  • Web server – a computer/software (Apache, Nginx) that stores websites and sends pages to browsers.
  • Web hosting – renting space on a web server so a site is online 24×7.

Browsers, cookies and plug-ins

A web browser (Chrome, Firefox, Edge, Safari) requests and displays web pages. Cookies are small text files a website saves in your browser to remember login, language or cart. Add-ons / plug-ins extend what a browser can do.

Frequently Asked Questions

What is the difference between HTTP and HTTPS?
HTTPS is HTTP with encryption (TLS/SSL). Data between browser and server cannot be read by others, shown by the lock icon.
Which protocols are used for email?
SMTP sends mail; POP3 or IMAP receive/download mail from the server.
What does DNS do?
It translates a domain name such as www.example.com into the IP address of the server, like a phone book for the Internet.
← Class 12 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

Next topicNetwork Security Threats Your progress: 18 / 26 (69%) · Lesson 19 / 26 Continue →

How was this lesson?

Your feedback helps us make the content better.

Write a review or suggestion (optional)

After approval, your name and city may appear publicly with your review. Please do not write your email or phone number.

▶ CodingEasily on YouTube

Learn with video lessons in easy Hindi

Featured video: RDBMS Part 3 – Class XI Commerce IT

▶ Subscribe – it’s free