Back to the 2022 paper

Module 4: Transport Layer & Congestion Control

202214m

Explain the difference between TCP and UDP. A client residing on a host with IP address 122.45.12.7 sends a message to the corresponding server residing on a host with IP address 200.112.45.90. If the well-known port is 161 and the ephemeral port is 51000, what are the pair of socket addresses used in this communication?

Worked SolutionAI Assisted

Part 1 — Difference between TCP and UDP

Parameter TCP UDP
Nature Connection-oriented (3-way handshake) Connectionless
Reliability Reliable — ACK, retransmission, sequencing Unreliable best-effort
Ordering Yes, via sequence numbers No
Flow control Sliding window (rwnd) None
Congestion control Slow start, congestion avoidance, fast recovery None
Header 20–60 bytes Fixed 8 bytes
Data unit Byte-stream segment (no message boundaries) Datagram (preserves message boundaries)
Multiplexing Port numbers Port numbers
Overhead / speed Higher overhead, slower Lightweight, faster
Use cases HTTP, FTP, e-mail, file transfer DNS, DHCP, VoIP, streaming, gaming

Part 2 — Socket addresses for the given communication

Given:

  • Client IP =122.45.12.7= 122.45.12.7, ephemeral port =51000= 51000
  • Server IP =200.112.45.90= 200.112.45.90, well-known port =161= 161

Concept: a socket address = (IP address, port number) pair. The port selects the process on a host, while the IP selects the host itself. A TCP/UDP connection (or datagram exchange) is identified by the pair of socket addresses — source and destination.

Step 1 — Server (destination) socket:

Server socket=(200.112.45.90, 161)\text{Server socket} = (200.112.45.90,\ 161)

Step 2 — Client (source) socket: the client uses its own IP with an ephemeral (temporarily assigned) port chosen above 49151.

Client socket=(122.45.12.7, 51000)\text{Client socket} = (122.45.12.7,\ 51000)

Step 3 — The pair of socket addresses:

(Client: 122.45.12.7:51000)⟷(Server: 200.112.45.90:161)\boxed{(\text{Client: } 122.45.12.7:51000) \quad \longleftrightarrow \quad (\text{Server: } 200.112.45.90:161)}

  • Destination socket = (200.112.45.90, 161) — the well-known port 161 (SNMP's standard port) identifies the server process.
  • Source socket = (122.45.12.7, 51000) — the ephemeral port 51000 identifies the client process and lets the server's reply be demultiplexed back to it.
  • Traffic from client to server is addressed to 200.112.45.90:161 with source 122.45.12.7:51000; the response simply reverses these two addresses.

Final answer: socket addresses = (122.45.12.7, 51000) and (200.112.45.90, 161), i.e. 122.45.12.7:51000 ↔ 200.112.45.90:161.

Similar questions

Student FinanceWeb Platform

Pocketly — Personal Finance for Students

Keep your hostel and college expenses under control. Track accounts, log spending in seconds, and stay within your monthly budget.