Networking
Why This Matters
A single computer is a powerful tool. Two or more computers connected together become something qualitatively different — a system where information flows between people and machines without anyone carrying a disc or printout across town. Networking transforms isolated calculation machines into a communication infrastructure that accelerates every other technology.
Why Connect Computers
Before you invest the considerable effort of building a network, understand what it buys you:
Resource sharing: Your settlement might have one printer, one large data storage system, or one machine powerful enough to run complex calculations. A network lets every connected computer use these resources without being in the same room.
Communication: Send messages between buildings, workshops, or settlements. Faster than a messenger, more reliable than shouting, and it creates a written record.
Redundancy: Store copies of critical data on multiple machines. If one fails, the information survives.
Coordination: Multiple people can work on related problems simultaneously, sharing results in real time rather than waiting for handoffs.
Physical Connections
Point-to-Point Serial
The simplest network: two computers connected by a wire. This is where you start.
Signal format (RS-232 style):
- Two wires minimum: signal and ground
- Data is sent one bit at a time (serial)
- A “1” is represented by one voltage level (e.g., +5V), a “0” by another (e.g., 0V)
- Both machines must agree on the speed (baud rate) — how many bits per second
Practical implementation:
- Run a twisted pair of copper wires between the two machines
- Connect the signal wire to the transmit output of machine A and the receive input of machine B
- Connect the ground wires together
- For two-way communication, run a second signal wire in the opposite direction (three wires total: TX, RX, ground)
| Baud Rate | Bits/Second | Characters/Second | Practical Use |
|---|---|---|---|
| 300 | 300 | ~30 | Minimal — sufficient for messaging |
| 1,200 | 1,200 | ~120 | Text transfer |
| 9,600 | 9,600 | ~960 | File transfer |
| 19,200 | 19,200 | ~1,920 | Fast transfer, short distances |
Start at 300 Baud
Get two machines talking at 300 baud first. This is slow but extremely tolerant of noise, bad wiring, and timing errors. Once it works reliably, increase speed and troubleshoot any issues that appear.
Twisted Pair Wiring
Twisting two wires together dramatically reduces electromagnetic interference. Any external noise affects both wires equally, and the receiver circuit subtracts one from the other, canceling the noise.
Making twisted pair cable:
- Cut two lengths of insulated copper wire to the needed length plus 10% slack
- Anchor one end of both wires to a fixed point
- At the other end, hold both wires together and twist clockwise — aim for 2-3 twists per centimeter
- Maintain consistent tension while twisting
- Secure the ends to prevent unraveling
For longer runs (over 50 meters): Use shielded twisted pair. Wrap the twisted pair in a layer of metal foil (tin or copper) connected to ground at one end only. This blocks external interference from motors, generators, and lightning.
Maximum Cable Length
Signal quality degrades with distance. For a 9,600 baud connection, keep cable runs under 100 meters. For 300 baud, you can reach 500 meters or more. Beyond these limits, add a repeater (a simple circuit that receives the signal and retransmits it at full strength).
Network Topologies
When connecting more than two computers, you must choose how they connect to each other.
Bus Topology
All computers connect to a single shared wire (the bus).
How it works:
- Run one long cable through the building or area
- Each computer taps into this cable at its location
- When one computer transmits, all others receive the signal
- Only the intended recipient processes the message; others ignore it
Advantages: Uses the least cable. Easy to add new computers — just tap into the bus.
Disadvantages: If the bus cable breaks anywhere, the entire network fails. Only one computer can transmit at a time.
Construction:
- Use a heavy copper wire as the bus (2-3 mm diameter for low resistance)
- Terminate both ends of the bus with a resistor matching the cable’s characteristic impedance (typically 50-100 ohms) to prevent signal reflections
- Each computer connects via a short drop cable to the bus
Star Topology
All computers connect to a central hub.
How it works:
- Place a hub device in a central location
- Run a separate cable from each computer to the hub
- When a computer transmits, the hub receives the signal and forwards it to the destination (or to all ports)
Advantages: If one cable fails, only that computer loses connectivity. Easy to troubleshoot — test each cable independently.
Disadvantages: Uses more cable. The hub is a single point of failure. Requires building the hub device.
| Factor | Bus | Star |
|---|---|---|
| Cable needed | Least | Most |
| Failure impact | Total (cable break) | Partial (one link) |
| Max computers | ~30 (signal degradation) | Limited by hub ports |
| Troubleshooting | Hard | Easy |
| Hub required | No | Yes |
| Recommendation | Small, co-located systems | Any serious installation |
Build Star
For any network you plan to operate long-term, use star topology. The extra cable cost is repaid many times over by easier maintenance and partial-failure resilience. A broken cable in a bus network means everyone is offline until you find and fix it.
Packet Switching
Instead of dedicating a wire to a single conversation (circuit switching, like telephony), packet switching breaks data into small chunks (packets) that share the network.
Packet Structure
Every packet needs three parts:
[HEADER] [DATA] [CHECKSUM]
Header (8-16 bytes):
- Destination address (which computer should receive this)
- Source address (who sent it)
- Packet sequence number (for reassembling multiple packets in order)
- Data length (how many bytes of data follow)
Data (1-256 bytes):
- The actual information being transmitted
- Keep packets small — large packets occupy the network longer, blocking others
Checksum (1-2 bytes):
- A calculated value that lets the receiver verify the data arrived intact
- Simplest method: add up all the bytes in the header and data, and store the result (modulo 256)
Addressing
Every computer on the network needs a unique address — a number that identifies it.
Simple scheme: Assign each computer a number from 1 to 254. Address 0 is reserved for “no address” and 255 for “broadcast to all computers.”
Store each computer’s address in a switch setting or configuration register. When a packet arrives, the computer compares the destination address to its own. Match: process the packet. No match: ignore it.
Routing Between Networks
To connect two separate networks (e.g., two buildings, each with their own star network), use a router — a computer connected to both networks that forwards packets between them.
Router logic:
- Receive packet on network A
- Check destination address
- If the destination is on network A, ignore (the local network already delivered it)
- If the destination is on network B, retransmit the packet on network B
- Maintain a simple table mapping address ranges to networks
Protocols
A protocol is a set of rules that both sides agree to follow. Without protocols, two computers are just making noise at each other.
Framing — Start and Stop Bits
The receiver needs to know where each byte begins and ends.
Asynchronous serial framing:
- The line is held high (+5V) when idle
- To send a byte, first send a start bit (pull the line low for one bit period)
- Send the 8 data bits, least significant first
- Send one or two stop bits (hold the line high)
- The receiver detects the falling edge of the start bit and samples the following 8 bit periods
This is the same principle as RS-232 serial communication and works reliably even with slight timing differences between sender and receiver.
Error Detection
Data corruption is inevitable over long wires or in electrically noisy environments.
Parity bit: Add one extra bit to each byte. Count the 1s in the data — if even, set parity to 0; if odd, set parity to 1 (even parity). The receiver checks the count. If the parity does not match, the byte is corrupted.
Checksum: Sum all bytes in the packet. Send the sum as the last byte(s). The receiver recalculates and compares. Catches most multi-bit errors that parity misses.
CRC (Cyclic Redundancy Check): A more mathematical approach — divide the data by a fixed polynomial and send the remainder. Catches virtually all errors including burst errors. More complex to implement but worth it for critical data.
| Method | Overhead | Detection Rate | Implementation |
|---|---|---|---|
| Parity | 1 bit per byte | ~50% of multi-bit errors | Simple |
| Checksum | 1-2 bytes per packet | ~99% of random errors | Easy |
| CRC-8 | 1 byte per packet | ~99.6% of all errors | Moderate |
| CRC-16 | 2 bytes per packet | ~99.998% of all errors | Moderate |
Acknowledgments and Retransmission
Error detection tells you something went wrong. Acknowledgments let you fix it.
Stop-and-wait protocol:
- Sender transmits packet and starts a timer
- Receiver checks the packet — if valid, sends a short ACK (acknowledgment) packet back
- Sender receives ACK and sends the next packet
- If the timer expires without an ACK, the sender retransmits the same packet
- After 3-5 retransmissions with no ACK, report a communication failure
Timer Duration
Set the timeout longer than the round-trip time (time for packet to reach receiver plus time for ACK to return). Too short: you retransmit before the ACK arrives, wasting bandwidth. Too long: you wait unnecessarily after a lost packet. Start with 2x the expected round-trip time.
Ethernet Basics
Ethernet solves the fundamental problem of shared-medium networks: what happens when two computers try to transmit at the same time?
CSMA/CD (Carrier Sense Multiple Access with Collision Detection)
- Listen before transmitting (Carrier Sense): Check if the wire is quiet. If another computer is transmitting, wait.
- Transmit your packet once the wire is clear.
- Listen while transmitting (Collision Detection): If you detect another signal on the wire at the same time as your own, a collision has occurred.
- If collision detected: Stop transmitting immediately. Send a brief jam signal so all stations know a collision occurred.
- Wait a random time before trying again. Each station picks a different random delay, so they do not collide again.
- If it collides again: Double the maximum random delay range and try again. After 16 failures, give up and report an error.
This is simple, elegant, and requires no central controller. It works well when the network is less than 40% utilized. Above that, collisions become frequent and throughput drops.
Ethernet Frame Format
[Preamble] [Dest Address] [Source Address] [Length] [Data] [CRC]
8 bytes 6 bytes 6 bytes 2 bytes 46-1500 4 bytes
For a simplified implementation, you can reduce address size to 1 byte (supporting 254 devices) and skip the preamble if your hardware handles synchronization.
Building Network Hardware
A Simple Hub
A hub is a device that receives a signal on any port and repeats it out all other ports.
Construction:
- Build a small box with one connector per computer (plus one for power)
- Inside, connect all signal-in lines to a common bus through buffer amplifiers
- Each buffer reads the incoming signal and drives it onto the shared bus
- Each port’s signal-out line is driven from the common bus
- Add collision detection: if two or more input buffers are active simultaneously, drive a collision signal on all ports
For a network of 4-8 computers, a simple hub built from transistor amplifiers works well.
A Simple Switch
A switch is smarter — it learns which computer is connected to which port and only forwards packets to the correct port.
Logic:
- When a packet arrives on port 3, read the source address and record: “Address 5 is on port 3”
- Read the destination address. Look up which port that address was last seen on
- Forward the packet only to that port
- If the destination address is unknown, forward to all ports (like a hub)
This requires a small address table (256 entries maximum for 1-byte addresses) and more processing capability than a hub, but it dramatically reduces network congestion.
Network Interface
Each computer needs a network interface — the hardware that connects it to the cable and handles the protocol.
Minimum components:
- A UART (Universal Asynchronous Receiver/Transmitter) for serial data conversion
- A line driver and receiver (transistor circuits that drive and read the cable)
- A small buffer to hold incoming data while the computer processes it
Start with Serial
Your first network does not need Ethernet. Start with simple serial connections (point-to-point or multi-drop) using the UART hardware you already have from your computing work. Add Ethernet-style collision detection only when you need more than 4-5 computers sharing a single cable.
Practical Applications
File Transfer
The most immediately useful network application. Transfer programs, data, documents, and records between machines.
Simple file transfer protocol:
- Sender sends a “file start” packet with filename and total size
- Receiver acknowledges readiness
- Sender sends data packets in sequence, each numbered
- Receiver acknowledges each packet
- After the last packet, sender sends “file end”
- Receiver assembles all packets into the complete file and verifies total checksum
Messaging
A text messaging system between networked computers.
- Each computer runs a simple program that checks for incoming message packets
- To send: type a message, specify the destination address, and transmit
- The message packet includes sender address, timestamp, and text
- The receiving computer displays the message and optionally sounds an alert (bell or buzzer)
Shared Printer
One computer is designated as the print server.
- Any computer on the network can send a “print job” — a series of packets containing the text or data to print
- The print server queues incoming jobs and feeds them to the printer in order
- It sends status messages back: “printing,” “done,” “error — paper jam”
| Application | Network Speed Needed | Complexity | Immediate Value |
|---|---|---|---|
| Messaging | 300 baud | Low | High — replaces messengers |
| File transfer | 1,200+ baud | Medium | High — backup and sharing |
| Shared printer | 1,200+ baud | Medium | Medium — saves hardware |
| Remote monitoring | 300 baud | Low | High — sensors and alerts |
| Shared database | 9,600+ baud | High | High — centralized records |
Troubleshooting
| Problem | Symptom | Check |
|---|---|---|
| No communication | No signal at receiver | Cable continuity, power at both ends |
| Garbled data | Random characters | Baud rate mismatch, check both ends |
| Intermittent errors | Occasional bad packets | Cable near motors/generators, add shielding |
| Collisions constant | Very slow network | Too many computers transmitting — add a switch |
| One computer unreachable | Others work fine | That computer’s cable or interface |
| Hub overload | All connections slow | Upgrade to a switch for directed traffic |
What’s Next
With local networking established, you can expand:
- Internet Infrastructure — Connect networks across distances using routers and long-haul links
- Telecommunications — Integrate voice and data communication over shared infrastructure
- Telephony — Review the circuit-switched communication that underpins your physical layer
Networking — At a Glance
Start with: Point-to-point serial at 300 baud between two machines Cable: Twisted pair copper, 2-3 twists per cm, shielded for long runs Best topology: Star (hub or switch in center) for reliability Packet format: Header (address, length) + Data + Checksum Error handling: Checksum for detection, ACK + retransmit for correction Ethernet principle: Listen before transmitting, random backoff on collision Hub vs switch: Hub repeats to all ports; switch learns and forwards selectively Max cable (9,600 baud): ~100 meters without repeater First applications: Messaging (300 baud) and file transfer (1,200+ baud) Critical rule: Both ends must agree on speed, framing, and protocol — document everything