Computer Networks & Communication
Unit-I in full: from bits on a wire to frames on a LAN. Every concept below is paired with a live animation — press play, watch the packet move, and the theory sticks.
01Data Communications & Network Types
A network moves data between devices. For communication to happen, five components must exist: message, sender, receiver, medium, protocol. Delivery must be on time, accurate, and error-free.
Three data-flow (duplex) modes
Simplex = one-way only · Half-duplex = both ways, one at a time · Full-duplex = both ways simultaneously.
02Network Types — LAN, MAN, WAN
Networks are classified by geographical span: LAN (a room/building), MAN (a city), WAN (a country / the world).
LAN
- Small area: office, lab, building
- High speed (Gbps), low error
- Owned by one organisation
WAN
- Connects cities/countries
- Point-to-point leased lines + routers
- Slower, higher error, expensive
03Connection-Oriented vs Connectionless
Is the path set up before the data flows, or is every packet on its own?
| Property | Connection-oriented (TCP) | Connectionless (UDP) |
|---|---|---|
| Setup | Needs handshake first | None |
| Order | Guaranteed | Not guaranteed |
| Reliability | ACKs + retransmission | Best effort |
| Overhead | High | Low |
| Used by | File transfer, web | Streaming, DNS, VoIP |
04Network Devices
Modem, Hub, Switch, Router — the "physical chain" from your home to the internet. Each one works at a different layer.
Modem
MODulator–DEModulator. Converts digital ↔ analog so signals can travel over phone lines.
Hub
Physical-layer repeater. Broadcasts every frame to all ports — wasteful, collisions.
Switch
Data-link device. Learns MAC addresses, forwards only to the destination port.
Router
Network-layer device. Routes between networks using IP addresses.
05Network Models — OSI & TCP/IP
Both are layered architectures. Each layer talks only to its neighbours and adds its own header — that's encapsulation.
OSI — 7 layers (reference model)
| Layer | What it does |
|---|---|
| 7 Application | Network services to apps (HTTP, FTP) |
| 6 Presentation | Encoding, encryption, compression |
| 5 Session | Dialogue control, checkpoints |
| 4 Transport | Segments, end-to-end delivery, ports |
| 3 Network | Packets, logical (IP) addressing, routing |
| 2 Data link | Frames, MAC addressing, error control |
| 1 Physical | Bits, signals, media |
TCP/IP — 5 layers (practical model)
| Layer | OSI equivalent |
|---|---|
| 5 Application | 7 + 6 + 5 combined |
| 4 Transport | 4 |
| 3 Network | 3 |
| 2 Data link | 2 |
| 1 Physical | 1 |
06Physical Layer — Digital Signals
Computers speak in digital signals — discrete voltage pulses (0/1). A periodic digital signal has amplitude, period/frequency, and phase.
Transmission impairment
Signals weaken and deform as they travel: attenuation (loss of energy), distortion (components arrive out of sync), noise (unwanted signals added on top).
dB = 10·log₁₀(P2/P1) — always add dB, multiply ratios.07Data-Rate Limits & Performance
Two hard ceilings govern any channel: Nyquist (noiseless) and Shannon (noisy). Performance is judged by throughput, latency, and bandwidth.
Shannon:
Transmission:
Total latency:
2B·log₂L — many students forget the factor of 2.08Line Coding — Digital-to-Digital
Converting a bit stream into voltage signals. Unipolar = one polarity; polar = positive/negative. Watch all six schemes draw themselves on the bits 0 1 0 0 1 1 1 0.
Comparing the schemes
| Scheme | Self-clocking? | DC component? | Used for |
|---|---|---|---|
| Unipolar NRZ | No | Yes | Rare (baseline wander) |
| NRZ-L | No | Yes (long runs) | Simple digital links |
| NRZ-I | No | Reduced | USB, 100Base-FX |
| Manchester | Yes | No | Ethernet (10Base-T) |
| Differential Manchester | Yes | No | Token Ring |
09Transmission Media (Guided)
Guided media = the signal is contained in a conductor: twisted-pair, coaxial cable, or optical fibre.
| Medium | Speed class | Typical use |
|---|---|---|
| Twisted pair (STP/UTP) | 10 Mbps – 10 Gbps | Telephone, Ethernet |
| Coaxial cable | 10–100 Mbps | CATV, older Ethernet |
| Optical fibre | Gbps–Tbps | Backbones, WAN, submarine cables |
10Switching — Packet Switching
In packet switching, data is chopped into packets that travel independently. Two flavours: datagram (each packet routed on its own) and virtual circuit (path reserved first).
| Datagram | Virtual circuit | |
|---|---|---|
| Setup | None | Needed (setup phase) |
| Routing decision | Per packet | Once, at setup |
| Ordering | May be lost/reordered | In order |
| Best for | Email, web | Voice, video |
11Data-Link Layer — Addressing & ARP
Four levels of addressing exist on the internet. At the link layer we use MAC (physical) addresses, and ARP translates an IP address into a MAC address.
| Level | Address | Length | Example |
|---|---|---|---|
| Application | Port number | 16 bits | 443 (HTTPS) |
| Network | IP address | 32 bits (v4) | 141.23.56.23 |
| Data link | MAC address | 48 bits | AA:BB:CC:11:22:33 |
| Physical | — | — | — |
12Block Coding & Error Detection — CRC
Block coding adds redundancy by mapping m data bits to n codeword bits (e.g. 4B/5B). CRC (Cyclic Redundancy Check) appends a checksum so the receiver can detect corrupted frames.
CRC in one sentence
Append (divisor_len − 1) zeros to the data, divide the whole thing by the divisor using XOR, and attach the remainder. The receiver re-divides; a non-zero remainder means the frame is corrupt.
1011001, divisor 1011 (x³+x+1). Append 3 zeros → 1011001000.
Divide by 1011 → remainder 011. Transmit 1011001 011.13CSMA / CSMA-CD
Carrier Sense Multiple Access: listen before you talk. In Ethernet (CSMA/CD), if two stations transmit at once → collision → both stop, wait a random backoff, and retry.
| Persistence method | Behaviour |
|---|---|
| 1-persistent | If busy, keep listening; send immediately when free (aggressive — collisions) |
| Non-persistent | If busy, wait a random time then listen again (calmer) |
| p-persistent | If free, send with probability p; else wait for the next slot |
14Formula Sheet & 5 Near-Certain Questions
Formulas you must own
| Quantity | Formula |
|---|---|
| Data rate (Nyquist) | C = 2B·log₂L bps |
| Data rate (Shannon) | C = B·log₂(1 + SNR) bps |
| dB | dB = 10·log₁₀(P₂/P₁) |
| Bit rate ↔ baud | bit rate = baud × log₂L |
| Transmission time | T = frame size / rate |
| Propagation time | T = distance / speed |
| Total latency | T = propagation + transmission + queueing |
| CRC remainder | data·2^(n−1) mod divisor (XOR division) |
| Throughput | Th = actual bits delivered / time |