Please enable JavaScript to use CodeHS

Networking and IT

How devices talk

When you send a text, stream a video, or load a website, your device is talking to other devices. Networks make that conversation possible. This tutorial explains the basics of how devices communicate.

Packets ~10 min Middle / High School
The Big Idea

What is a network?

A network is a group of connected devices that can share data. Your home Wi-Fi is a network. Your school Wi-Fi is a network. The internet is a giant network of networks.

A small local network is called a LAN, or Local Area Network. A network that spans a city or region is a MAN, and one that covers a large area like a country or the world is a WAN. The internet is the largest WAN.


How It Works

Packets and protocols

When you send data over a network, it is broken into small pieces called packets. Each packet has a header with information like where it came from, where it is going, and its place in the message. The packets travel independently and are reassembled at the destination.

A protocol is a set of rules devices follow so they can understand each other. Common protocols include TCP for reliable delivery, UDP for fast delivery, and HTTP for web pages.


Vocabulary

IP and MAC addresses

Every device on a network needs an address. An IP address is a logical address used to route packets across networks. It looks like 192.168.1.42 or a longer IPv6 address. IP addresses can change when a device reconnects.

A MAC address is a hardware address built into the network card. It does not change and is used on the local network to make sure packets reach the right physical device.


Roles

Clients and servers

A client is a device that asks for something, like your phone or laptop. A server is a device that provides something, like a web page or a video file. The same device can be both in different situations.

When you type a URL, your browser is the client. It sends a request to a server, which sends back the data your browser needs to build the page.


Interactive

Packet journey simulator

Click Send packet to watch a message split, travel, and reassemble. Each hop represents a router or switch along the way.

Your laptop
Server
Ready to send.

Code

Two devices talking over TCP

Two computers can send messages to each other over a TCP socket. This example starts a tiny server and a tiny client on your own machine.


Your Turn

Check yourself

Why is it useful to break a message into packets instead of sending it all at once?

Your answer:

Sample answer: Packets can take different paths, share the network with other traffic, and be re-sent if one is lost. This makes the network more reliable and efficient.


Check Yourself

Quick quiz

1. What is a packet?

2. Which device asks for data?

3. What is an IP address?

Keep learning

You know how devices talk. Next, learn how those conversations become the internet and the web.

First tutorial in the Networking and IT series.