Internet Basics 🌐📦🛣️
Understand the invisible road your data travels. Every app open = thousands of packets racing across the world!
Day 31: How the Internet Works — The Invisible Road!
What Actually Happens When You Open Instagram?
You tap Instagram. In less than a second, your phone sends a request to a server in another country, that server sends back millions of bytes of data, and your feed appears. How? The internet breaks everything into tiny packets, ships them across the world, and reassembles them perfectly on your screen. Every single time!
The Internet = Global Post Office
Imagine sending a big book to a friend in Tokyo. Instead of one giant package, you tear it into 100 pages, put each in a separate envelope, and send them all. Each envelope takes the fastest available route. Some go through Dubai, some through Singapore. They all arrive and your friend reassembles the book in order. That's exactly how the internet works!
Your message or request gets split into packets. Each packet travels independently through routers. Routers are like sorting hubs — they find the fastest path. Packets arrive and get reassembled in order at the destination!
IP Address — Your Digital Home Address
Every device on the internet has an IP address — like a home address for your phone or laptop. When you send data, it has your IP as the return address and the destination's IP as the delivery address. Without IP addresses, packets would have no idea where to go!
import socket
website = "google.com"
ip = socket.gethostbyname(website)
print(f"Website : {website}")
print(f"IP Address : {ip}")
print(f"Your Machine : {socket.gethostname()}")
Output: Website: google.com, IP Address: 142.250.195.46, Your Machine: Your-Laptop. Python just asked the internet "what's Google's address?" and got the answer. That's DNS — the internet's phone book!
DNS — The Internet's Phone Book
You type "google.com" but computers don't understand names — they understand numbers. DNS converts "google.com" into 142.250.195.46 automatically. Like looking up a contact name in your phone to get their number. Every time you visit any website, DNS runs silently in the background!
Real World Connection
When you send a WhatsApp message, it's broken into packets, travels through multiple countries, and arrives at your friend's phone in milliseconds. When you watch YouTube, thousands of video packets race from Google's servers to your screen continuously. When you pay on PhonePe, payment data packets travel encrypted to banking servers and back. This all happens every time, invisibly, perfectly!
Internet vs Web — Not the Same!
The internet is the global road network — cables, routers, packets. The Web is just one vehicle that drives on that road — websites you visit in a browser. Email, WhatsApp, GPS, online gaming — none of these are the Web. They all use the internet but aren't websites. Internet is the road. Web is one car on it!
Common Mistakes
Mistake 1 — Thinking internet and web are the same.
Internet = global network infrastructure. Web = websites on top of it. WhatsApp uses the internet but is not the web!
Mistake 2 — Incomplete domain name in code.
socket.gethostbyname("google") # WRONG — needs full domain!
socket.gethostbyname("google.com") # CORRECT
Mini Challenge
Mini Challenge
Import socket and find the IP addresses of 3 websites — youtube.com, github.com and instagram.com. Print them all. You're literally querying the internet's phone book from your Python code!
Quick Quiz
Q: What are packets? A: Small chunks that big data gets broken into for travel across the internet!
Q: What does DNS do? A: Converts human-readable names like "google.com" into IP addresses like 142.250.195.46!
Q: Is WhatsApp part of the Web? A: No! It uses the internet but it's not the Web. Web = websites in browsers only!
Key Takeaways
Key Takeaways
- Internet breaks data into packets, routes them independently and reassembles at destination.
- Every device has an IP address — the internet's home address system.
- DNS converts domain names to IP addresses — the internet's phone book.
- Internet is the global road. Web is just one vehicle on that road.
- Every tap on every app triggers thousands of invisible packets racing across the world!
Continue Learning with Rohi
You've used your 3 free Rohi questions. Create a free account to continue learning.