Networking
The practice of connecting computers and systems to share resources and communicate with each other.
What is Networking?
Networking is how computers talk to each other. Whether you are sending an email, loading a website, or streaming a video, networking makes it happen. It is the foundation of the internet and every connected application.
For developers, understanding networking means knowing how data travels from your code to users around the world.
Basic Networking Concepts
IP Address: Unique identifier for each device on a network. Like a home address but for computers.
- IPv4:
192.168.1.1 - IPv6:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Domain Name: Human-readable names that map to IP addresses.
google.com→142.250.180.46
DNS (Domain Name System): Phone book of the internet. Converts domain names to IP addresses.
Port: Specific endpoint on a device. Different services use different ports.
- HTTP: Port 80
- HTTPS: Port 443
- SSH: Port 22
- PostgreSQL: Port 5432
Client-Server Model
Most networking follows this pattern:
Client: Requests data (your browser, mobile app) Server: Provides data (web server, API server)
Client (Browser) → Request → Server (Website)
Client (Browser) ← Response ← Server (Website)
Simple but powerful model that runs the internet.
Protocols
Protocols are rules for how data is sent and received:
HTTP/HTTPS: Web browsing, APIs TCP: Reliable data transfer (guarantees delivery) UDP: Fast data transfer (no guarantee, good for video/gaming) WebSocket: Two-way real-time communication FTP: File transfers SMTP: Sending email
How the Internet Works
- You type
google.comin browser - DNS lookup:
google.com→ IP address - Browser connects to Google server via TCP
- Browser sends HTTP request
- Server processes request
- Server sends HTTP response with HTML
- Browser renders the page
All in milliseconds!
Request and Response
HTTP Request has:
- Method (GET, POST, PUT, DELETE)
- URL (where to send request)
- Headers (metadata like auth tokens)
- Body (data being sent, for POST/PUT)
HTTP Response has:
- Status code (200, 404, 500, etc.)
- Headers (content type, cache rules)
- Body (the actual data - HTML, JSON, etc.)
Localhost vs Remote
localhost (127.0.0.1): Your own machine
fetch("http://localhost:3000/api/users")
Remote: Another computer somewhere else
fetch("https://api.example.com/users")
When developing, you test on localhost. When deploying, users access remote servers.
Network Tools Developers Use
ping: Check if server is reachable
ping google.com
curl: Make HTTP requests from terminal
curl https://api.example.com/users
netstat: See active network connections
netstat -an
traceroute: See path data takes to destination
traceroute google.com
Postman/Insomnia: Test APIs with nice UI
Firewalls and Security
Firewall: Controls what network traffic is allowed in/out
VPN: Encrypts your connection, hides your IP
Proxy: Intermediary between client and server
SSL/TLS: Encrypts data in transit (the "S" in HTTPS)
Security is critical. Always use HTTPS in production.
Common Network Problems
Timeout: Server took too long to respond
Connection Refused: Nothing listening on that port
DNS Resolution Failed: Cannot find IP for domain
CORS Error: Browser blocking cross-origin request
502 Bad Gateway: Reverse proxy cannot reach backend
Understanding errors helps you debug faster.
Latency and Bandwidth
Latency: Time for data to travel (measured in milliseconds)
- Local: 1-10ms
- Same country: 20-50ms
- Different continent: 100-300ms
Bandwidth: Amount of data that can transfer (measured in Mbps/Gbps)
Good apps minimize requests and optimize data size to handle latency and bandwidth limits.
CDN (Content Delivery Network)
Servers distributed worldwide that cache your content closer to users.
User in Tokyo accesses your site:
- Without CDN: Data travels from US server (200ms latency)
- With CDN: Data comes from Tokyo server (10ms latency)
Services: Cloudflare, AWS CloudFront, Fastly
APIs and Networking
APIs are how services communicate over networks:
// Your app makes network request
const response = await fetch("https://api.stripe.com/v1/charges", {
method: "POST",
headers: {
"Authorization": `Bearer ${apiKey}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ amount: 1000, currency: "usd" })
})
const data = await response.json()
Understanding networking helps you build better APIs and debug issues.
WebSockets
HTTP is request-response. WebSockets enable continuous two-way communication.
Use cases: Chat apps, live notifications, real-time collaboration, multiplayer games
const socket = new WebSocket("wss://example.com/chat")
socket.onmessage = (event) => {
console.log("Message:", event.data)
}
socket.send("Hello!")
Network Performance Optimization
Reduce Requests: Fewer network calls = faster apps
Use Compression: Gzip/Brotli compress responses (smaller = faster)
Caching: Store data locally to avoid repeat requests
HTTP/2: Multiple requests over single connection
Lazy Loading: Load resources only when needed
For Beginners
You do not need to be a networking expert to build apps. But knowing the basics helps you:
- Debug connection issues
- Optimize performance
- Understand security
- Design better systems
Start simple. Understand client-server, HTTP requests, and status codes. Build from there.
The Bottom Line
Networking is how your code reaches users. Understanding how data travels from your server to browsers around the world makes you a better developer.
You do not need deep networking knowledge for most development work. But knowing the fundamentals helps you build faster, more reliable applications.