net/go.book
All Parts Marketing

Introduction to Networking

Somewhere in the last few seconds, before you even opened this book, your phone quietly asked the world a question. Maybe it checked for a new message. Maybe it refreshed a weather forecast, or synced a photo, or pinged a server to see if an app update exists. You didn't ask it to. You didn't watch it happen. And yet in that instant, a tiny packet of data left your device, hopped across a Wi-Fi radio, squeezed through a router the size of a paperback novel, rode a beam of light down a literal glass fiber for some number of miles, arrived at a machine you will never see in a building you will never visit, got an answer, and came all the way back — probably before you finished reading this sentence.

That is networking. Not the diagrams. Not the acronyms. That — the completely unglamorous, invisible, relentless act of machines finding each other and agreeing on something — is the actual subject of this book, and it is, quietly, one of the most audacious engineering achievements humans have ever pulled off. We are so surrounded by it that we've stopped noticing it, the way you stop noticing the hum of a refrigerator. This book is about learning to hear the hum again — and then learning to build with it, in Go.

Wait — Why Learn This When AI Can Write the Code?

Let's have this conversation honestly, right at the start, because if you're holding this book in 2026 you have almost certainly asked yourself some version of it: AI can already write a TCP server. Why am I about to spend hundreds of pages learning to do it myself?

Here's the honest answer: because someone still has to know whether the code is right, and that someone is going to be you.

An AI model is extraordinary at producing plausible code quickly. It is not, and structurally cannot be, a substitute for judgment about a system it has never operated, never watched fail at 3 a.m., and has no stake in the consequences of. When a generated server leaks connections under load, or a "working" API silently drops packets at scale, or an agent-written script opens a security hole nobody asked for, the debugging still happens in a human skull. The gap between "code that compiles" and "system that survives contact with the real internet" is exactly the gap this book exists to close — and it is a gap that gets more valuable, not less, the more code gets written by machines that don't understand what they built.

Think about it from the other direction, too. The people most effective at directing AI tools right now aren't the people who know the least — they're the people who know enough to ask precise questions, spot a wrong answer in one glance, and push back when a generated solution is subtly broken. Understanding networking doesn't compete with using AI well; it's the exact thing that makes you dangerous at using it well. An engineer who understands what a socket, a timeout, and a race condition actually are can direct ten AI-assisted projects at once, catch the mistakes the model can't see, and ship things a non-technical operator never could. That's not a smaller job than "writing code by hand." It's a bigger one.

AI changes who writes the first draft of the code. It has not changed who is responsible for understanding it.

And there's a simpler truth underneath all of that: networking isn't going anywhere. Every AI model you've ever talked to is itself served over a network, to a datacenter, over protocols invented decades before it existed, running on infrastructure someone still has to design, secure, and keep online. Learning this book's contents doesn't compete with the future — it's a hard prerequisite for building any part of it.

This Book Doesn't Just Explain Networking — It Explains Go's Favorite Job

There's a reason this book pairs networking with Go specifically, instead of any other language: Go was built for this. It was designed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson specifically to make writing fast, concurrent, network-facing software feel almost boring in the best way — no fighting the language, no fifty-line boilerplate just to open a socket, no bolted-on concurrency model that fights you at every turn.

And the software world noticed. Docker, the tool that put containers on every developer's laptop, is written in Go. Kubernetes, the system that now orchestrates a staggering share of the world's cloud infrastructure, is written in Go — and was born inside Google, the same company that built the language. Cloudflare, which routes a meaningful fraction of all internet traffic through its edge network, leans on Go heavily for exactly the kind of high-throughput networking code you're about to learn to write. Uber, Twitch, Dropbox, and Netflix all run Go in production for backend and networking-heavy services. HashiCorp built its entire toolchain — Terraform, Vault, Consul, Nomad — in Go, precisely because those tools live and die by reliable networked communication between machines. CockroachDB, a distributed database designed to survive entire datacenters going dark, is Go from top to bottom.

What You Could Actually Build With This

It's worth pausing to be concrete about what's on the other side of this book, because "networking" can sound abstract until you connect it to things you'd actually want to make:

  • Your own backend, from scratch. Every API, every app server, every "log in and see your data" product you've ever used is a networking problem wearing a business idea's clothes. Part APIs, later in this book, walks you through building real, production-shaped backends — the exact skill that turns a side-project idea into a shippable product without needing to hire anyone.
  • Security work, offense and defense. Part 3 of this book is a full, hands-on introduction to network security — scanning, packet analysis, building your own security tools — taught for authorized, ethical use. Almost every security skill, red team or blue team, is a networking skill first.
  • Real-time, real-world systems. Chat apps, multiplayer games, live dashboards, IoT fleets talking to a hub, financial systems streaming ticks in microseconds — all of it is networking with a domain-specific coat of paint.
  • Infrastructure other people depend on. Load balancers, proxies, service meshes, the invisible plumbing that keeps modern software running — someone builds and maintains that plumbing, and this book teaches the exact skills they use.
  • A path to building something entirely your own. A remarkable number of successful software companies started as one person who understood systems well enough to build the first version alone, on a laptop, before anyone else was involved. Understanding networking removes an entire category of "I'd need a team for that" from your mental map of what's possible.

None of this requires you to already be an expert. It requires you to start, which is what the rest of this book is for.

Why Networking Matters, Concretely

Have you ever sent a meme to a friend, streamed a movie, or checked your bank account online? All of these everyday miracles are powered by networking. It's the machinery that lets your device talk to others, whether they're next door or on the opposite side of the planet — and, crucially, it's machinery you are about to learn to build yourself, not just use.

Analogy: Think of networking as the postal system for the digital world. Instead of letters and packages, we send data — emails, files, cat videos — using protocols and addresses to make sure everything arrives safely and on time.

What Exactly Is a Network?

Strip away the buzzwords and a computer network is just three ingredients working together: nodes (devices with something to say — laptops, phones, servers, smart thermostats), links (the physical or wireless medium that carries signals between them), and protocols (the shared rules that turn raw electrical or radio signals into meaning). Remove any one of those and you don't have a network — you have a pile of disconnected hardware, or worse, two machines shouting incompatible nonsense at each other.

This is why plugging two computers together with a cable does not, by itself, create a working network. The cable is the easy part. The hard part — the part this entire book is really about — is agreeing on the rules: how big is a message, how do you know where it starts and ends, what do you do if part of it gets lost, how does the receiver tell the sender "I got it" or "please resend"? Every protocol you will meet in this book, from Ethernet to TCP to HTTP, is really just a very precise, very stubborn set of answers to those questions.

Networking is not about wires; it is about agreement on rules. Wires only carry voltage — protocols are what turn voltage into meaning.

Circuit Switching vs. Packet Switching

Here's a piece of history that explains a lot of why modern networks look the way they do. The very first long-distance communication networks — the telephone system — used circuit switching: when you made a call, the phone company physically (later, electronically) reserved a dedicated path of wire between you and the other person for the entire duration of the call, even during the silent pauses. It was reliable and predictable, but wildly wasteful: a line sat idle whenever nobody was talking, yet nobody else could borrow it.

The engineers who built the ARPANET (whose full, dramatic story is the next chapter) made a different bet: packet switching. Instead of reserving a dedicated path, a message is chopped into small chunks called packets, each stamped with a destination address, and each packet finds its own way across whatever links happen to be free at that moment — possibly taking a different route than the packet before it. The receiving end reassembles them in order. This is dramatically more efficient, because thousands of conversations can share the same link, interleaved packet by packet, and it's also more resilient: if one link goes down, packets simply route around it. The entire internet, and everything in this book, is built on packet switching.

Aspect Circuit Switching Packet Switching
Path Dedicated for the whole session Chosen per packet, can vary
Resource use Reserved even when idle Shared, used only when sending
Failure behavior Call drops if the path breaks Packets reroute around failures
Latency Very consistent Can vary (jitter)
Real-world example Traditional landline phone call Web browsing, email, video calls

Networking in the Real World

Picture a busy airport: planes (data packets) take off and land, guided by air traffic control (protocols), following strict rules to avoid chaos. Networks work the same way — orderly, rule-driven, but full of surprises. Consider three real networks you interact with every day, and notice how different their scale and rules feel even though they all run on the same underlying ideas:

  • Your home Wi-Fi: A handful of devices (phone, laptop, smart TV, maybe a game console) all talking to one consumer router, which in turn talks to your internet service provider. Trust is high, security is loose (one shared password), and the whole thing is designed to be plugged in and forgotten.
  • A corporate office network: Hundreds or thousands of devices, segmented into departments, protected by firewalls, monitored by IT staff, with strict rules about who can talk to whom. A guest laptop in the lobby should never be able to reach the finance department's file server.
  • A datacenter network: Tens of thousands of servers that mostly talk to each other (not to the outside world) at enormous speed and volume, engineered for redundancy so that a single failed switch or cable never takes anything offline.

Same core ideas — nodes, links, protocols — applied at wildly different scales with wildly different priorities. That range, from a single Bluetooth earbud to a hyperscale datacenter, is exactly what "networking" as a field covers.

A common misconception
"The internet" is not one network — it is a network of networks (that's literally what "inter-net" means). Your ISP's network, your university's network, and Google's datacenter network are all separately owned and operated; they simply agree to exchange packets with each other using common protocols. There is no single company or computer "running" the internet.

What You'll Learn

  • The core concepts that make networks tick
  • How devices find and talk to each other
  • The difference between a local chat and a global broadcast
  • Why security is crucial (and how attackers try to break things)
  • How to build your own networked apps in Go, from scratch — real code, starting properly in just a few pages

Fun Facts

  • Did you know the first message ever sent over the ARPANET (the internet's ancestor) was just two letters: "LO"? The system crashed before they could finish typing "LOGIN"! Even the internet had a rough first day — you're in good company if your own first program doesn't work on the first try.
  • The word "modem" is a portmanteau of "modulator-demodulator" — a small, uncelebrated piece of naming genius from an era when every new networking concept needed a word invented for it on the spot.
  • There is currently more data crossing the world's undersea cables in a single day than existed in total on Earth's computers as recently as the early 1990s.

Diagram: The Networking Universe

[User] <==> [Device] <==> [Router] <==> [Internet] <==> [Server]
  • User: That's you!
  • Device: Your computer, phone, or IoT gadget
  • Router: The traffic cop of your home network
  • Internet: The global network of networks
  • Server: Where websites, apps, and data live

Every hop in that diagram is a place where a protocol decision gets made: your device decides how to frame data for the router, the router decides which path to send it down, and the server decides how to interpret what finally arrives. Nothing "just happens" — every arrow is doing real work, and by the end of this book you will understand every single one of them well enough to build your own.

Frequently Asked Questions

If AI can already write a TCP server, is this chapter's argument just an appeal to nostalgia? Not at all — it's a much narrower claim than "learn it because tradition demands it." The claim is that someone has to catch a generated server leaking connections under load or silently dropping packets at scale, and that job only gets more valuable as more of the first-draft code around it gets written by something that has never watched a system fail at 3 a.m.

Why does this book bother pairing networking with Go specifically, instead of teaching the concepts language-agnostically? Because Go wasn't retrofitted for this job, it was built for it from the start, by people at Google who had already spent years fighting the exact problem of coordinating many machines over unreliable networks. Docker, Kubernetes, and Cloudflare's edge network didn't choose Go by accident — they all share that same core problem, and this book is teaching you the language practitioners reach for first, not a random one that happens to have a networking chapter bolted on.

Is packet switching just a technical detail, or does it actually matter that ARPANET's engineers chose it over circuit switching? It matters enormously, and you'll feel its consequences for the rest of this book — every tradeoff about jitter, resilience, and shared bandwidth traces straight back to that one 1960s design decision. Circuit switching would have given you perfectly steady timing at the cost of reserving a wire nobody else could use during silences; packet switching gave up that steadiness in exchange for thousands of conversations sharing the same link, which is exactly the bargain the modern internet still runs on.

Is "the internet" the same thing as one single, unified network? No, and this is one of the most common misconceptions this chapter corrects directly: the internet is a network of networks, each separately owned and operated, that simply agree to exchange packets using shared protocols. There is no single company or machine "running" it, which is precisely why the postal-system analogy earlier in this chapter works so well — lots of independent carriers, one shared set of addressing rules.

Why doesn't this chapter, or the rest of Part 1, show any actual Go code? Because the goal right now is getting the shape of networking solidly into your head first — nodes, links, protocols, and the tradeoffs between them — with nothing else competing for your attention. Code arrives immediately afterward in the Go Fundamentals part, and by the time you write your first networked program there, every concept it touches will already feel familiar instead of brand new.

Where This Goes From Here

Hold on to that diagram, because every chapter left in Part 1 is really just zooming into one of those arrows and asking "but how, exactly?" How does a device decide which router to hand a packet to? What actually happens inside that router? How does a server, juggling thousands of simultaneous conversations, know which reply belongs to which stranger? None of it "just happens" — every one of those arrows is doing real, specific, learnable work, and by the time you reach the end of this book you will understand every single one of them well enough to build your own.