Computer Networks Assignment –
Answers
Q1.
Q: When closing a TCP connection, why is the two-segment-lifetime timeout not necessary
on the transition from LAST_ACK to CLOSED?
A: Because in the LAST_ACK state, the host has already sent a FIN and is simply waiting for
an acknowledgment of its own FIN. Once this ACK is received, the connection is fully closed,
and no duplicate segments can exist that would cause confusion. Therefore, the two-
segment-lifetime wait (as used in TIME_WAIT) is not needed.
Q2.
Q: Why might an application developer choose UDP over TCP?
A: - Lower latency (no connection establishment overhead).
- No congestion/flow control (application gets full control).
- Suitable for real-time applications (VoIP, gaming, streaming).
- Simpler protocol with smaller header size.
- Supports multicast and broadcast.
Q3.
Q: Can checksum guarantee no bit errors?
A: No. The Internet checksum can detect most errors but not all. Different error patterns can
produce the same checksum (undetected errors). Hence, the receiver cannot be absolutely
certain that no bit errors have occurred.
Q4.
Q: In TCP, if HLEN = 0111, how many bytes of options are included?
A: HLEN = 7 → TCP header length = 7 × 4 = 28 bytes. Standard header size = 20 bytes.
Options = 28 – 20 = 8 bytes.
Q5.
Q: cwnd = 3000, rwnd = 5000, unacknowledged = 2000. How many more bytes can be sent?
A: Transmission limit = min(cwnd, rwnd) = 3000. Unacknowledged = 2000. Remaining =
1000 bytes.
Q6.
Q: TCP at 1 MB/s, seq starts 7000. When does it wrap?
A: Sequence number space = 2^32 = 4,294,967,296. Time = 4,294,967,296 / 1,048,576 ≈
4096 seconds ≈ 68 minutes.
Q7.
Q: Why 3 or 4 segments for TCP termination? Define control segments.
A: Four-way handshake is needed because FIN and ACK are separate. Sometimes 3
segments (when ACK and FIN combined). Control-only segments: SYN, FIN, RST.
Q8.
Q: Why do SYN, SYN+ACK, and FIN consume seq numbers but ACK does not?
A: SYN and FIN represent events in the data stream (virtual bytes), so they consume a
sequence number. ACKs simply acknowledge received data; they do not represent new data,
hence no sequence number is consumed.
Q9.
Q: Sequence numbers are 5-bit. What is seq of 100th packet?
A: Range = 0–31 (modulo 32). After 100 packets: 100 mod 32 = 4. Answer = 4.
Q10.
Q: Two TCP segments: first seq=90, second seq=110.
A: a) Data in first segment = 20 bytes.
b) If first lost, B expects byte 90, so ACK = 90.
Q11.
Q: Host A → B: B received up to 126. A sends two segments (80 and 40 bytes).
A: a) Second segment: seq=207, source=302, dest=80.
b) If first arrives first: ACK=207, src=80, dest=302.
c) If second arrives first: ACK=127.
Q12.
Q: Go-Back-N with m=3, Sf=62, Sn=66, Rn=64.
A: a) Packets in transit: 62, 63, 64, 65.
b) ACKs in transit: 62, 63.
Q13.
Q: TCP Congestion Control
A: Uses Slow Start, Congestion Avoidance, Fast Retransmit, and Fast Recovery.
Timeout → stronger sign of congestion.
3 duplicate ACKs → weaker sign (only one packet lost).
Q14.
Q: Why not retransmit after first duplicate ACK?
A: Because the first duplicate ACK may occur due to packet reordering, not loss. Waiting for
3 duplicate ACKs ensures higher confidence.
Q15.
Q: TCP 1-Gbps link, wraparound time?
A: Sequence space = 2^32. Data rate = 1 Gbps. Time ≈ 34.36 seconds.
Q16.
Q: Design reliable protocol (1 Gbps, RTT=140 ms, MSL=60s).
A: Bandwidth-delay product = 17.5 MB. Sequence number space must cover 7.5 GB.
Sequence number bits ≈ 33. Window bits ≈ 25.
Q17.
Q: Stop-and-wait efficiency ≥ 50%, channel=4 kbps, delay=20 ms.
A: Efficiency ≥ 0.5 → frame size ≥ 160 bits (20 bytes).
Q18.
Q: TCP Reno over 10 Mbps, RTT=150 ms, MSS=1500B.
A: a) Max window ≈ 125 segments.
b) Avg window ≈ 83 segs, throughput ≈ 6.6 Mbps.
c) Recovery ~9.3 s.
Q19.
Q: TCP Nagle’s Algorithm (MSS=30B, 10B/10ms).
A: Segments: 10B, 30B, 30B, 30B. Yes, some reach MSS size.
Q20.
Q: Reno TCP: cwnd=5, ssthresh=8.
A: 3 ACKs → cwnd=8. 5 dup ACKs → ssthresh=4, cwnd=4. 2 ACKs → cwnd=6. Timeout →
cwnd=1, ssthresh=4.
Q21.
Q: Slow start, RTT=10ms, rwnd=24 KB, MSS=2 KB.
A: Takes ≈ 50 ms to send full window.
Q22.
Q: TCP cwnd=18 KB, timeout occurs.
A: After 4 bursts: 1, 2, 4, 8 KB.
Q23.
Q: TCP window 65,535B, 1 Gbps, delay=10 ms.
A: Throughput ≈ 52 Mbps. Line efficiency ≈ 5%.
Q24.
Q: Max segment=128B, MSL=30s, 8-bit seq.
A: Max rate ≈ 8.5 Kbps.
Q25.
Q: Receiver window=1 MB. Probability seq inside window?
A: Probability ≈ 2.3 × 10^-7.
Q26.
Q: Throughput complaint.
A: a) Utilization: 47% and 13%.
b) Window ~2 KB.
c) Required window ~16 KB.
Q27.
Q: RTT=100ms, window=32 KB.
A: Max throughput = 2.56 Mbps.
Q28.
Q: 100 Mbps, RTT=1 ms.
A: Min window size = 12.5 KB.
Q29.
Q: TCP window 10,000B, ack=22001. New ack=24001, rwnd=12,000.
A: Before: 22001–32000. After: 24001–36000.
Q30.
Q: Slow start, RTT=60 ms, bandwidth=1 Gbps, MSS=576B.
A: Window ≈ 13,020 segments. Time to reach ≈ 13 seconds.