2022 question paper

Computer Networks

18 questions

  1. Q1a. A proxy server is used as the computer (i) with external access (ii) acting as a backup (iii) performing file handling (iv) accessing user permissions20222m

    Module 5: Application Layer & Security

    A proxy server is used as the computer

    (i) with external access
    (ii) acting as a backup
    (iii) performing file handling
    (iv) accessing user permissions

    View this question on its own page →
    Worked Solution

    Answer: (i) with external access

    Why: A proxy server sits between the internal clients and the outside internet, fetching resources on their behalf — so it is the computer with external access that works on behalf of internally-restricted hosts. It is not a backup machine, a file-handling server, or a permission-management host.

  2. Q1b. The term 'WAN' stands for (i) Wide Area Net (ii) Wide Access Network (iii) Wide Area Network (iv) Wide Access Net20222m

    Module 1: Physical Layer & Data Communication

    The term 'WAN' stands for

    (i) Wide Area Net
    (ii) Wide Access Network
    (iii) Wide Area Network
    (iv) Wide Access Net

    View this question on its own page →
    Worked Solution

    (iii) Wide Area Network

    A WAN spans large geographical areas — cities, countries, or continents — typically connecting multiple LANs, often using leased telecom lines or satellite links. The internet itself is the largest example of a WAN.

  3. Q1c. Which layer of the TCP/IP stack corresponds to the OSI model transport layer? (i) Host-to-host (ii) Application (iii) Internet (iv) Network access20222m

    Module 1: Physical Layer & Data Communication

    Which layer of the TCP/IP stack corresponds to the OSI model transport layer?

    (i) Host-to-host
    (ii) Application
    (iii) Internet
    (iv) Network access

    View this question on its own page →
    Worked Solution

    (i) Host-to-host

    The Host-to-Host layer in TCP/IP provides the same end-to-end, process-to-process delivery service as the OSI Transport layer, using TCP (reliable) or UDP (unreliable).

  4. Q1d. What is the maximum header size of an IP packet? (i) 32 bytes (ii) 64 bytes (iii) 30 bytes (iv) 60 bytes20222m

    Module 3: Network Layer & Routing

    What is the maximum header size of an IP packet?

    (i) 32 bytes
    (ii) 64 bytes
    (iii) 30 bytes
    (iv) 60 bytes

    View this question on its own page →
    Worked Solution

    Answer: (iv) 60 bytes

    Why: The IPv4 header length field (IHL) is 4 bits, giving 24−1=152^4 - 1 = 15 words of 4 bytes = 15×4=6015 \times 4 = 60 bytes total header, i.e. a maximum header size of 60 bytes (the minimum is 20 bytes with no options). 32/64/30 bytes do not correspond to any IHL-derived value; 64 would be the header limit only under protocols like IPv6's usual 40-byte base + extensions pattern.

  5. Q1e. The address which is used to identify a process on a host is (i) physical address (ii) port address (iii) logical address (iv) specific address20222m

    Module 4: Transport Layer & Congestion Control

    The address which is used to identify a process on a host is

    (i) physical address
    (ii) port address
    (iii) logical address
    (iv) specific address

    View this question on its own page →
    Worked Solution

    Answer: (ii) port address

    Why: A port number (port address) identifies a specific process/application on a host, enabling transport-layer process-to-process (end-to-end) delivery — e.g. port 80 → web server. The physical address identifies a NIC, the logical (IP) address identifies the host itself, and "specific address" is not a recognised addressing category.

  6. Q1f. Which sublayer of the information link layer performs circuit functions that depend on the kind of medium? (i) Media access control sublayer (ii) Logical link control sublayer (iii) Network interface control sublayer (iv) Both (i) and (ii)20222m

    Module 2: Data Link Layer & MAC Sublayer

    Which sublayer of the information link layer performs circuit functions that depend on the kind of medium?

    (i) Media access control sublayer
    (ii) Logical link control sublayer
    (iii) Network interface control sublayer
    (iv) Both (i) and (ii)

    View this question on its own page →
    Worked Solution

    (i) Media Access Control (MAC) sublayer

    The Data Link layer is commonly split into two sublayers:

    • LLC (Logical Link Control): medium-independent — handles flow control, error control, and framing in a way that's the same regardless of the underlying physical medium (Ethernet, Wi-Fi, etc.).
    • MAC (Media Access Control): medium-dependent — handles the specific rules for accessing the shared physical medium, which vary by technology (e.g. CSMA/CD for Ethernet, CSMA/CA for Wi-Fi). It also handles physical/MAC addressing.

    Since the MAC sublayer's functions specifically depend on the type of medium in use, it is the correct answer.

  7. Q1g. Transport layer protocol deals with (i) application-to-application communication (ii) node-to-node communication (iii) the process-to-process communication (iv) Both (i) and (ii)20222m

    Module 4: Transport Layer & Congestion Control

    Transport layer protocol deals with

    (i) application-to-application communication
    (ii) node-to-node communication
    (iii) the process-to-process communication
    (iv) Both (i) and (ii)

    View this question on its own page →
    Worked Solution

    Answer: (iii) the process-to-process communication

    Why: The transport layer uses port numbers to deliver data from a sending process on one host to the correct process on the destination host (it also performs multiplexing/demultiplexing). Node-to-node communication is the data link layer's job, and "application-to-application" is not the standard term — the application layer connects user-facing software, while the transport layer beneath it handles processes.

  8. Q1h. FTP server (i) maintains state information (ii) is stateless (iii) has single TCP connection for a file transfer (iv) has UDP connection for file transfer20222m

    Module 5: Application Layer & Security

    FTP server

    (i) maintains state information
    (ii) is stateless
    (iii) has single TCP connection for a file transfer
    (iv) has UDP connection for file transfer

    View this question on its own page →
    Worked Solution

    Answer: (i) maintains state information

    Why: FTP is stateful: the server tracks the control connection, the logged-in user, the current working directory and the transfer mode. It is not stateless (HTTP, by contrast, is), it uses two TCP connections (control port 21 + data port 20) rather than a single one, and file transfer runs over TCP, never UDP.

  9. Q1i. Which of the following is the multiple access protocol for channel access control? (i) CSMA/CD (ii) CSMA/CA (iii) Both CSMA/CD and CSMA/CA (iv) HDLC20222m

    Module 2: Data Link Layer & MAC Sublayer

    Which of the following is the multiple access protocol for channel access control?

    (i) CSMA/CD
    (ii) CSMA/CA
    (iii) Both CSMA/CD and CSMA/CA
    (iv) HDLC

    View this question on its own page →
    Worked Solution

    (iii) Both CSMA/CD and CSMA/CA

    Both are multiple access protocols in the "random access with carrier sense" family, used to control which station gets to use a shared channel at a given moment:

    • CSMA/CD (Collision Detection) — used in traditional (shared-medium) Ethernet; detects collisions after they occur and stops transmission early.
    • CSMA/CA (Collision Avoidance) — used in Wi-Fi (802.11); since wireless collisions are hard to detect, it proactively tries to avoid them (via random backoff and optional RTS/CTS handshaking).

    HDLC (High-Level Data Link Control) is not a multiple access protocol at all — it's a bit-oriented, point-to-point/point-to-multipoint data link protocol for framing and reliable transfer, unrelated to shared-channel access control.

  10. Q1j. Physical layer provides (i) mechanical specifications of electrical connectors and cables (ii) electrical specification of transmission line signal level (iii) specification for IR over optical fiber (iv) All of the above20222m

    Module 1: Physical Layer & Data Communication

    Physical layer provides

    (i) mechanical specifications of electrical connectors and cables
    (ii) electrical specification of transmission line signal level
    (iii) specification for IR over optical fiber
    (iv) All of the above

    View this question on its own page →
    Worked Solution

    (iv) All of the above

    The Physical layer covers everything needed to physically move raw bits across a medium: mechanical specs (connector/cable shape and pin layout), electrical specs (voltage levels, signal timing), and specifications for the transmission medium itself, including optical/IR links. So all three listed items fall under its scope.

  11. Budget App•POCKETLY

    Pocketly on Android

    Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.

    Install Pocketly
  12. Q2. Explain the duties of different layers in TCP/IP model.202214m

    Module 1: Physical Layer & Data Communication

    Explain the duties of different layers in TCP/IP model.

    View this question on its own page →
    Worked Solution

    The TCP/IP protocol suite is organized into four layers, each with distinct duties:

    +-------------------------------+
    |   Application Layer           |  HTTP, FTP, SMTP, DNS, Telnet
    +-------------------------------+
    |   Transport Layer (Host-Host) |  TCP, UDP
    +-------------------------------+
    |   Internet Layer              |  IP, ICMP, ARP, IGMP
    +-------------------------------+
    |   Network Access Layer        |  Ethernet, Wi-Fi, PPP
    +-------------------------------+
    

    1. Network Access (Link) Layer
    Combines the OSI Physical + Data Link layers. Responsible for:

    • Physical addressing (MAC addresses)
    • Framing data into frames for the transmission medium
    • Media access control and error detection at the link level
    • Interfacing directly with the physical hardware (NIC, cabling, wireless medium)

    2. Internet Layer
    Equivalent to the OSI Network layer. Responsible for:

    • Logical (IP) addressing of hosts
    • Routing packets across interconnected networks, choosing best paths
    • Fragmentation and reassembly of packets to fit different network MTUs
    • Handled mainly by IP, with ICMP for error reporting and ARP for address resolution

    3. Transport (Host-to-Host) Layer
    Equivalent to the OSI Transport layer. Responsible for:

    • End-to-end, process-to-process delivery between applications
    • TCP: connection-oriented, reliable, ordered delivery with flow and congestion control
    • UDP: connectionless, best-effort, low-overhead delivery
    • Segmentation of application data and reassembly at the receiver

    4. Application Layer
    Combines OSI's Application, Presentation, and Session layers. Responsible for:

    • Providing network services directly to user applications
    • Data formatting, encryption/compression (presentation concerns)
    • Session management between communicating processes
    • Implemented by protocols like HTTP (web), FTP (file transfer), SMTP (email), DNS (name resolution)

    Each layer only interacts with the layers directly above and below it, passing data downward by encapsulation (adding headers) on the sending side, and upward by decapsulation (removing headers) on the receiving side.

  13. Q3. What do you mean by the term 'ethernet'? What are the types of cable commonly used for ethernet?202214m

    Module 1: Physical Layer & Data Communication

    What do you mean by the term 'ethernet'? What are the types of cable commonly used for ethernet?

    View this question on its own page →
    Worked Solution

    Ethernet is a family of wired LAN technologies, standardized as IEEE 802.3, that defines how devices on a local network frame, address, and access a shared or switched medium. Originally based on CSMA/CD (Carrier Sense Multiple Access with Collision Detection) over a shared bus, modern Ethernet mostly runs over switched, full-duplex links where collisions don't occur.

    An Ethernet frame includes fields for destination/source MAC address, a type field, the data payload, and a trailing CRC for error detection.

    Common cable types used for Ethernet

    Cable type Standard Typical speed Notes
    Coaxial (Thicknet/Thinnet) 10BASE5 / 10BASE2 10 Mbps Legacy, bus-topology Ethernet, largely obsolete
    Twisted pair (UTP), Cat 5e/6/6a 100BASE-TX, 1000BASE-T, 10GBASE-T 100 Mbps – 10 Gbps Most common in modern LANs; uses RJ-45 connectors
    Fiber optic (single-mode/multi-mode) 1000BASE-SX/LX, 10GBASE-SR/LR 1 Gbps – 100+ Gbps Used for backbones, long-distance, or high-speed links; immune to EMI

    Twisted-pair copper (Cat 5e/6) is by far the most common choice for desktop/office connections today, while fiber is preferred for data-center backbones and long-haul links.

  14. Q4. Differentiate between pure aloha and slotted aloha with examples.202214m

    Module 2: Data Link Layer & MAC Sublayer

    Differentiate between pure aloha and slotted aloha with examples.

    View this question on its own page →
    Worked Solution

    Pure ALOHA

    In pure ALOHA, a station transmits a frame the moment it has one ready, without checking whether the channel is idle or coordinating with other stations in any way. If two stations' transmissions overlap in time even partially, both frames are destroyed (collision), and each station must wait a random backoff time before retrying.

    • Vulnerable time = 2 x Tfr (frame transmission time), since a collision can happen if any other station starts within one frame-time before or after this station's own transmission begins.
    • Maximum throughput ≈ 18.4% (at G = 0.5), where G is the offered load.

    Example: Station A sends a frame at t=5ms. If Station B starts transmitting anytime between t=4ms and t=6ms (assuming Tfr=1ms), both frames collide and are lost.

    Slotted ALOHA

    Slotted ALOHA improves on pure ALOHA by dividing time into discrete slots, each exactly equal to one frame transmission time. A station is only permitted to begin transmission at the start of a slot — it must wait if its data becomes ready mid-slot.

    • Vulnerable time = 1 x Tfr, since collisions can now only occur if two stations pick the exact same slot (partial overlaps across slot boundaries are eliminated by the synchronization).
    • Maximum throughput ≈ 36.8% (at G = 1) — exactly double pure ALOHA's maximum.

    Example: With 1ms slots, if Station A transmits in the slot starting at t=5ms, a collision only occurs if Station B also chooses to transmit in that same [5ms, 6ms) slot; B cannot start mid-slot at, say, t=5.5ms.

    Key contrast

    Aspect Pure ALOHA Slotted ALOHA
    Transmission timing Immediate, unsynchronized Must align to slot boundaries
    Vulnerable time 2 x Tfr 1 x Tfr
    Max throughput ~18.4% ~36.8%
    Needs global clock sync No Yes

    Halving the vulnerable window by requiring slot-synchronized transmission is what allows slotted ALOHA to double pure ALOHA's maximum achievable throughput, at the cost of needing all stations to share a common time reference.

  15. Q5. How data link layers provide flow and error control? Explain with examples.202214m

    Module 2: Data Link Layer & MAC Sublayer

    How data link layers provide flow and error control? Explain with examples.

    View this question on its own page →
    Worked Solution

    The Data Link layer provides both flow control and error control to ensure reliable, well-paced delivery of frames across a single link.

    Flow Control

    Flow control prevents a fast sender from overwhelming a slower receiver's buffer capacity. The Data Link layer achieves this primarily through the sliding window mechanism:

    • The receiver's available buffer space determines how many frames the sender is allowed to have outstanding (unacknowledged) at once — the window size.
    • As the receiver processes and acknowledges frames, the window "slides" forward, permitting the sender to transmit more.
    • Example: In Go-Back-N with window size N=4, the sender can have at most 4 frames in flight; it must pause once 4 are unacknowledged, resuming only as ACKs arrive.

    Error Control

    Error control detects (and where possible corrects) frames that were corrupted or lost during transmission, and arranges for recovery:

    1. Error detection — redundant bits (parity, checksum, or CRC) let the receiver verify whether a received frame matches what was sent.
      • Example: CRC using polynomial division catches virtually all common burst errors.
    2. Acknowledgement (ACK) — the receiver confirms successful, error-free receipt of a frame.
    3. Timeout and retransmission (ARQ — Automatic Repeat reQuest) — if the sender doesn't receive an ACK within a set time, it assumes the frame was lost or corrupted and retransmits.
      • Go-Back-N: retransmits the lost frame and every frame sent after it.
      • Selective Repeat: retransmits only the specific lost/corrupted frame, using individual timers and receiver-side buffering for out-of-order frames.

    Together: flow control governs how much data can be sent before pausing for acknowledgement, while error control governs what happens when a frame doesn't arrive correctly — both working through the same underlying sliding-window/ACK/timeout machinery to guarantee reliable link-level delivery.

  16. Q6. Describe RIP routing protocol with an example. Explain count to infinity problem and its countermeasures.202214m

    Module 3: Network Layer & Routing

    Describe RIP routing protocol with an example. Explain count to infinity problem and its countermeasures.

    View this question on its own page →
    Worked Solution

    RIP Routing Protocol, Example, Count-to-Infinity Problem and Countermeasures

    RIP (Routing Information Protocol) is a distance-vector (Bellman-Ford) interior gateway protocol in which every router periodically shares its entire routing table with its neighbours and computes routes as the minimum of the costs reported by its neighbours plus the cost of the link to each neighbour.

    1. Key characteristics

    • Metric: hop count; maximum usable metric = 15 hops, 16 = infinity (unreachable).
    • Update: full table every 30 s over UDP port 520 (RIPv1 broadcast 255.255.255.255; RIPv2 multicast 224.0.0.9).
    • RIPv1 is classful (no subnet mask, no VLSM); RIPv2 supports classless masks, authentication and next-hop field.
    • Simple to configure; used in small networks; limited by the 15-hop limit and slow convergence.

    2. Example

              A(1)---(1)B---(1)C
               |            /
               |----(1)D----/
    

    Link costs = 1 each.

    Round 1 (D advertises): D tells C "to A via me, cost 2" (D→A cost 1 + link 1). C computes A cost = 2+1 = 3.
    Round 2 (B advertises): B tells C "to A cost 1", so C recomputes A cost = 1+1 = 2 and installs route A → next hop B, metric 2 (better than via D = 3).
    Round 3: C shares with B and D; every router converges to its least-hop route:

    Router Destination Next hop Metric
    B A direct 1
    C A B 2
    D A direct 1
    C D direct 1

    Routers apply split horizon (never advertise a route back out the interface it was learned from) and delete stale entries after 180 s without an update (garbage-collection timer).

    3. Count-to-infinity problem

    If the A–B link fails, B loses its direct route to A. But C still advertises "A via D, metric 2" (stale, reverse of the old path), so B learns "A via C, cost 3" and advertises it to C. C then computes via B = 4, advertises 4 to B, B computes 5, and so on. Because each neighbour believes the other's stale distance is good news, the metric increments by 1 on every exchange until it reaches 16 (infinity) — a classic count-to-infinity loop where packets circulate while the metric climbs. Convergence is very slow (could be minutes), during which time packets are routed in circles.

    Root cause: distance-vector has no notion of "poisoned" routes — old stale information from a neighbour looks like new information.

    4. Countermeasures

    1. Split horizon: never advertise a route back the interface it came from — eliminates the basic A↔B↔C loop above.
    2. Poison reverse: actively advertise the failed route with metric 16 (infinity) to the neighbour from which it was learned, poisoning it faster than silence.
    3. Hold-down timer: on learning a route is unreachable, ignore updates about that route for a fixed period (typically 180 s), stopping stale bad news from being accepted.
    4. Triggered (flash) updates: advertise a change immediately on topology change instead of waiting for the 30 s periodic update, speeding convergence.
    5. Maximum metric 16: bounds the counting process — the count always terminates at infinity.

    Conclusion: RIP's periodic distance-vector updates make it simple, but the count-to-infinity problem makes convergence slow; split horizon, poison reverse, hold-down timers and triggered updates together mitigate it (modern link-state protocols such as OSPF avoid the problem entirely).

  17. Q7. An ISP is granted the block 80.70.56.0/21. The ISP needs to allocate addresses for two organizations each with 500 addresses, two organizations each with 250 addresses, and three organizations each with 50 addresses. (a) Find the number and range of addresses in the ISP block. (b) Find the range of addresses for each organization and the range of unallocated addresses.202214m

    Module 3: Network Layer & Routing

    An ISP is granted the block 80.70.56.0/21. The ISP needs to allocate addresses for two organizations each with 500 addresses, two organizations each with 250 addresses, and three organizations each with 50 addresses.

    (a) Find the number and range of addresses in the ISP block.
    (b) Find the range of addresses for each organization and the range of unallocated addresses.

    View this question on its own page →
    Worked Solution

    (a) ISP Block 80.70.56.0/21 — Number and Range

    Given: network address =80.70.56.0= 80.70.56.0, prefix =/21= /21.

    Step 1 — Number of addresses

    232−21=211=2048 addresses2^{32-21} = 2^{11} = 2048 \text{ addresses}

    Step 2 — Subnet mask: 21 bits = two full octets + 5 bits:

    255.255.248.0255.255.248.0

    Step 3 — Range: the third octet advances in steps of 256−248=8256 - 248 = 8, starting at 56, so it ends at 56+8−1=6356 + 8 - 1 = 63.

    • First address: 80.70.56.0
    • Last (broadcast) address: 80.70.63.255
    • Check: 8×256=20488 \times 256 = 2048 ✓

    Answer (a): 2048 addresses, from 80.70.56.0 to 80.70.63.255.


    (b) Allocation to Organisations and Unallocated Range

    Sizing rule: give each organisation the next power of two block that can hold the requested number of usable addresses (usable =2h−2= 2^h - 2 for a normal subnet).

    Demand Needed Smallest block Prefix Total addresses Usable (total − 2)
    2 × 500 500 /23 512 510 ✓ ≥ 500
    2 × 250 250 /24 256 254 ✓ ≥ 250
    3 × 50 50 /26 64 62 ✓ ≥ 50

    Sequential allocation from 80.70.56.0 upward:

    1. 2×512=10242 \times 512 = 1024 addresses
    2. 2×256=5122 \times 256 = 512 addresses
    3. 3×64=1923 \times 64 = 192 addresses

    Total used =1024+512+192=1728= 1024 + 512 + 192 = 1728 addresses.

    Organisation Block Address range Count
    Org 1 (500) 80.70.56.0/23 80.70.56.0 – 80.70.57.255 512
    Org 2 (500) 80.70.58.0/23 80.70.58.0 – 80.70.59.255 512
    Org 3 (250) 80.70.60.0/24 80.70.60.0 – 80.70.60.255 256
    Org 4 (250) 80.70.61.0/24 80.70.61.0 – 80.70.61.255 256
    Org 5 (50) 80.70.62.0/26 80.70.62.0 – 80.70.62.63 64
    Org 6 (50) 80.70.62.64/26 80.70.62.64 – 80.70.62.127 64
    Org 7 (50) 80.70.62.128/26 80.70.62.128 – 80.70.62.191 64

    Unallocated addresses:

    2048−1728=320 addresses⇒80.70.62.192 – 80.70.63.2552048 - 1728 = 320 \text{ addresses} \Rightarrow \textbf{80.70.62.192 – 80.70.63.255}

    (as 80.70.62.192/26 → 64 addresses, plus 80.70.63.0/24 → 256 addresses; 64+256=32064 + 256 = 320 ✓).

    Answer (b): Org1 → 80.70.56.0–80.70.57.255, Org2 → 80.70.58.0–80.70.59.255, Org3 → 80.70.60.0–80.70.60.255, Org4 → 80.70.61.0–80.70.61.255, Org5 → 80.70.62.0–80.70.62.63, Org6 → 80.70.62.64–80.70.62.127, Org7 → 80.70.62.128–80.70.62.191; unallocated range 80.70.62.192 – 80.70.63.255 (320 addresses).

  18. Q8. How transport layer provides congestion control? Differentiate between leaky bucket and token bucket algorithms.202214m

    Module 4: Transport Layer & Congestion Control

    How transport layer provides congestion control? Differentiate between leaky bucket and token bucket algorithms.

    View this question on its own page →
    Worked Solution

    Transport-Layer Congestion Control, and Leaky Bucket vs Token Bucket

    1. How the transport layer provides congestion control

    Congestion means the network's routers/links are carrying more traffic than their buffers and bandwidth can absorb, causing queueing delay, packet loss and throughput collapse. IP itself has no congestion control, so the end hosts — specifically TCP at the transport layer — control the rate at which they inject data, treating losses and delay as feedback signals.

    1. Window-based rate control. The sender may have at most min⁡(cwnd,rwnd)\min(\text{cwnd}, \text{rwnd}) unacknowledged bytes in flight; increasing cwnd increases the injection rate.
    2. Slow start. cwnd starts at 1 MSS and doubles once per RTT (exponential growth) until it reaches the slow-start threshold ssthreshssthresh or a loss occurs.
    3. Congestion avoidance. Beyond ssthreshssthresh, cwnd grows additively (+1 MSS per RTT) — probing cautiously for spare capacity (AIMD).
    4. Loss as congestion signal (multiplicative decrease).
      • 3 duplicate ACKs → fast retransmit + fast recovery: ssthresh=cwnd/2ssthresh = \text{cwnd}/2, cwnd=ssthresh+3\text{cwnd} = ssthresh + 3, then additive increase.
      • Timeout (severe congestion): ssthresh=cwnd/2ssthresh = \text{cwnd}/2, cwnd=1\text{cwnd} = 1 MSS, back to slow start.
    5. Explicit signals: ECN marks IP headers (CE bit) and the receiver echoes ECE so the sender reduces cwnd without loss; a receiver can also reduce its advertised rwnd, throttling the sender (receiver flow control).
    6. Retransmission timers with RTT estimation keep the in-flight data bounded so buffers upstream are not overrun.
     cwnd  |        additive increase (+1/RTT)
     (MSS) |      ______________/
           |     /      × loss → half (multiplicative decrease)
     ssth. |/____/ 
           | slow start (exponential)
           +---------------------------→ time/RTT
    

    2. Leaky bucket vs Token bucket

    Both are traffic-shaping (policing) algorithms that convert bursty input into a smoother, rate-limited output.

    Basis Leaky bucket Token bucket
    Working idea Packets enter a bucket (queue) and drain at a constant fixed rate; if full, arriving packets are dropped/rejected Tokens are generated at a fixed rate; a packet may be sent only if it grabs enough tokens, otherwise it waits
    Empty bucket Bucket empty ⇒ nothing to output Bucket empty ⇒ new packets may still be sent if burst capacity is available — the bucket accumulates surplus
    Burst tolerance No bursts — output is strictly uniform (any burst is delayed/dropped) Allows bursts up to the bucket's token capacity
    Output rate Always exactly the leak rate Average = token rate, but instantaneous bursts are permitted
    Implementation Simple FIFO queue with a timer Counter of tokens + queue
    Typical use Constant bit-rate shaping, hard policing Limiting average rate while permitting bursts (e.g. network access rate policing)
    Analogy Water leaks out of a punctured bucket at a fixed rate Coins are minted at a fixed rate; spending them authorises sending
    Burst after idle Cannot send a burst immediately Idle time accumulates tokens → burst up to bucket size can be sent instantly

    Essence: the leaky bucket enforces a rigid, smooth output rate and treats any excess as error, while the token bucket enforces a long-term average rate but deliberately allows bursts up to the accumulated token count — which is why it is preferred for real, bursty application traffic.

    Conclusion: congestion control is achieved end-to-end by TCP's AIMD window algorithms (slow start, congestion avoidance, fast recovery, ECN), and routers additionally police/shape traffic at entry points using leaky or token bucket algorithms.

  19. Q9. 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?202214m

    Module 4: Transport Layer & Congestion Control

    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?

    View this question on its own page →
    Worked Solution

    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.

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.