V1 TCP vs UDP: what are they?

TCPUDP
Connectionyes (3-way handshake)no
Reliableyes (ACK + resend)no
Order keptyesno
Speedslowerfaster
Header20 bytes8 bytes
Exampleweb, emailvideo call, game, DNS
What are TCP and UDP?
Two protocols of the Transport layer (layer 4) that carry data between programs using port numbers.
Full forms?
TCP = Transmission Control Protocol. UDP = User Datagram Protocol.
What is TCP in one line?
Connection-oriented and reliable: it first connects (3-way handshake), checks every packet arrived, resends lost ones, keeps order.
What is UDP in one line?
Connectionless and fast: it just sends, no checking, no resending.
Where is TCP used?
Web (HTTP/HTTPS), email (SMTP), file transfer (FTP), SSH.
Where is UDP used?
Video calls, live streaming, online games, DNS, DHCP.
Which is faster? Why?
UDP, because it has no connection setup and no acknowledgements.

V2 Types of networks

What is a computer network?
Two or more devices connected to share data and resources (files, printer, internet).
Types by area?
PAN, LAN, MAN, WAN.
Example of LAN?
Our college lab or home Wi-Fi.
Example of WAN?
The Internet (largest WAN).
Wired vs wireless?
Wired uses cables (Ethernet); wireless uses radio (Wi-Fi, Bluetooth).
What is the Internet?
A network of networks connected all over the world.
Intranet?
A private network inside one organisation (e.g. college Moodle on campus).

V3 OSI model (7 layers)

What is OSI?
Open Systems Interconnection: a 7-layer model that explains how data moves from one computer to another.
Name the 7 layers (top to bottom)
Application, Presentation, Session, Transport, Network, Data Link, Physical. Trick: All People Seem To Need Data Processing.
Which device works at which layer?
Hub = Physical (1), Switch = Data Link (2), Router = Network (3).
Which layer has IP? MAC? Port?
IP address = Network layer. MAC address = Data Link layer. Port numbers = Transport layer.
TCP/IP model layers?
4 layers: Application, Transport, Internet, Network Access.
OSI vs TCP/IP?
OSI is a 7-layer reference model; TCP/IP is the 4-layer model actually used on the Internet.

V4 Topologies

What is topology?
The layout / arrangement of how devices are connected.
Bus?
All devices on one main cable. Cheap, but if the main cable breaks the whole network stops.
Star?
All devices connect to one central switch/hub. Easy to manage; if the centre fails, all stop. Most used (our lab).
Ring?
Each device connects to two neighbours in a circle. One break can stop the ring.
Mesh?
Every device connects to every other. Very reliable but costly. Links = n(n-1)/2.
Tree and Hybrid?
Tree = stars connected in levels. Hybrid = mix of two or more topologies.
Which is the best?
Depends: star for offices and labs, mesh where reliability matters (backbone).

V5 Socket programming (basics)

ServicePort
HTTP80
HTTPS443
FTP21
SSH22
SMTP25
DNS53
POP3110
DHCP67 / 68
What is a socket?
One end of a communication link between two programs: IP address + port number.
What is a port?
A number that identifies a program/service on a computer (e.g. 80 for web).
Client vs server?
Server waits for requests and serves; client sends requests to the server.
TCP socket calls?
Server: socket, bind, listen, accept, read/write, close. Client: socket, connect, write/read, close.
UDP socket calls?
socket, bind (server), sendto, recvfrom, close. No listen/accept/connect.
SOCK_STREAM vs SOCK_DGRAM?
SOCK_STREAM = TCP, SOCK_DGRAM = UDP.
What is 127.0.0.1?
Localhost / loopback: means the same computer.

V6 Other basic questions

IP address vs MAC address?
IP = logical address, can change (192.168.1.5). MAC = physical address burned in the network card (48-bit, e.g. 3c:52:82:4a:1b:7e).
IPv4 vs IPv6?
IPv4 = 32-bit (192.168.1.1). IPv6 = 128-bit, written in hex with colons; made because IPv4 addresses ran out.
Hub vs switch vs router?
Hub sends data to all ports. Switch sends only to the right device (MAC). Router connects different networks (IP).
What is DNS?
Converts website names to IP addresses (google.com > 142.250.x.x).
What is DHCP?
Automatically gives IP address, mask, gateway to devices.
What does ping do?
Checks if another device is reachable (uses ICMP).
What is a protocol?
A set of rules for communication between devices.
What is bandwidth?
Maximum data that can be sent per second (e.g. 100 Mbps).