📝 TCP windows flow control (36 MCQs)
Receiver-Advertised Window for Buffer Protection
TCP flow control prevents a sender from overwhelming the receiving endpoint's buffer. The receiver advertises available space in the 16-bit Window field, called the receive window or rwnd. The sender limits unacknowledged data according to this advertised capacity, while a separate congestion window controls how much data may be placed into the network. It defines the boundary between application processes and packet delivery.
Why a Fast Sender Must Respect Receiver Capacity
A sender can produce data faster than an application reads it from the socket, causing the receiver's buffer to fill. Without feedback, incoming data could be discarded and recovery traffic would increase. TCP flow control communicates buffer availability so the sender can slow or stop its stream until the receiver has room again.
Window Advertisement and Sliding Byte Range
The receiver reports a window beginning at the next expected byte. As bytes are acknowledged and application data is consumed, the advertised right edge may advance. The sender may transmit within the permitted range, subject also to congestion control. Window scaling, negotiated during setup, extends the usable receive-window range beyond the 16-bit unscaled value.
A Receiver Reduces Its Advertised Window
Suppose the receiver expects byte 4000 and advertises rwnd of 6000 bytes. The sender may have data outstanding up to byte 9999, subject to cwnd. If the receiver later advertises 2000 bytes, the sender must respect the updated right edge for new data, even if its congestion window is larger.
Throughput, Buffer Sizing and Zero-Window Behaviour
A receive window that is too small can limit throughput on high-bandwidth, long-delay paths. A zero advertised window pauses ordinary new data until space becomes available; TCP uses persist mechanisms to probe for window updates that may have been lost. Flow control protects receiver memory but does not measure router or link congestion.
Separating Receiver Flow Control from Congestion Control
'The advertised window measures network congestion' is false: it reports receiver buffer capacity. 'A zero window means the connection has failed' is false: the receiver may simply be busy. 'The congestion window is sent in the TCP header' is false: cwnd is sender-side state, while the header carries the receiver's advertised window.
Exam Focus: Window Arithmetic and Sender Limits
Distinguish rwnd from cwnd and explain which endpoint maintains each value. Given a receiver's next expected byte and advertised window, calculate the right edge of the permitted range. Explain zero-window behaviour, persist probing, and the purpose of window scaling when a 16-bit window field would otherwise restrict high-bandwidth transfers. Use the assumptions stated in each question when calculating.
Key Terms for TCP Windows and Flow Control
- rwnd - Receiver-advertised available buffer space.
- cwnd - Sender limit based on network congestion.
- Window edge - Last permitted byte position.
- Zero window - Receiver reports no buffer space.
- Persist timer - Triggers zero-window probes.
- Window scaling - Extends advertised window beyond 16-bit range.
📝 All TCP windows flow control MCQs
Q1. What is the primary purpose of a TCP window?
📖 Explanation: The TCP window defines how many bytes a sender may transmit before receiving an acknowledgment, thereby regulating data flow between endpoints. It does not involve routing decisions, encryption, or IP address assignment, which are responsibilities of other layers. By limiting unacknowledged data, the window prevents buffer overflow and ensures reliable transmission.
Q2. If a sender's TCP window size is reduced from 64 KB to 16 KB during a connection, which effect is most likely?
📖 Explanation: A smaller window limits the amount of outstanding data, causing the congestion control algorithm to grow the congestion window more slowly. This throttles the sender’s ability to increase its sending rate, so the primary observable effect is a reduction in the growth of the congestion window, potentially lowering overall throughput.
Q3. How does the sliding‑window mechanism differ from stop‑and‑wait ARQ in terms of channel utilization?
📖 Explanation: Sliding‑window permits several packets to be transmitted before an acknowledgment is required, keeping the transmission medium occupied and improving efficiency. In contrast, stop‑and‑wait sends one packet and waits for its ACK, leaving the channel idle during the round‑trip, which results in lower utilization.
Q4. Given a network with a bandwidth of 10 Mbps and a round‑trip time (RTT) of 250 ms, what minimum TCP window size should be configured to fully utilize the link?
📖 Explanation: To fully utilize the path, the TCP window should match the bandwidth‑delay product: . The nearest option is 312 KB, ensuring the sender can keep the pipe full.
Q5. When a TCP receiver advertises a zero window size, what immediate behavior should the sender exhibit?
📖 Explanation: A zero‑window advertisement signals that the receiver’s buffer is full. The sender must halt sending new data and periodically probe the receiver (using a zero‑window probe) until a non‑zero window is advertised, after which transmission can resume.
Q6. Which of the following best explains why TCP uses a dynamic window size rather than a fixed one?
📖 Explanation: Network conditions such as congestion, latency, and available bandwidth fluctuate over time. A dynamic window allows TCP to increase the window when the path can handle more data and shrink it when congestion is detected, optimizing throughput and minimizing packet loss compared to a static, inflexible window.
Q7. In the context of TCP, how does the advertised window interact with the congestion window to determine the effective send window?
📖 Explanation: TCP uses both flow control (advertised window) and congestion control (congestion window). The sender may transmit only up to the smaller of the two limits, ensuring it does not exceed the receiver’s buffer capacity while also respecting network congestion constraints.
Q8. Suppose a TCP connection experiences intermittent packet loss causing the congestion window to halve repeatedly. How would this pattern affect the average throughput over a long period, assuming constant RTT?
📖 Explanation: Repeated halving of the congestion window reduces the amount of data that can be in flight, causing periodic drops in sending rate. Over time the system stabilizes at a lower average window size, yielding a reduced but non‑zero steady‑state throughput.
Q9. If the receiver’s advertised window is larger than the sender’s congestion window, which window limits the amount of data in transit?
📖 Explanation: When the advertised window exceeds the congestion window, the sender is constrained by its own congestion control parameters. Therefore, the congestion window becomes the limiting factor, dictating the maximum number of unacknowledged bytes that may be outstanding.
Q10. Compare the impact of increasing the initial TCP window size from 2 segments to 10 segments on the connection’s startup phase in a high‑latency environment.
📖 Explanation: In high‑latency networks, each round‑trip incurs significant delay. Starting with a larger window allows the sender to transmit more data before waiting for ACKs, shortening the slow‑start phase and reducing overall connection setup latency, provided the network can accommodate the burst.
Q11. How does TCP’s selective acknowledgment (SACK) option improve the efficiency of the sliding‑window protocol when multiple packets are lost?
📖 Explanation: SACK enables the receiver to convey the ranges of data that have arrived successfully, so the sender can retransmit only the missing segments rather than the whole window. This targeted recovery reduces unnecessary traffic, speeds up loss recovery, and improves overall throughput.
Q12. When a TCP sender receives a duplicate ACK indicating a missing segment, what standard algorithm does it typically invoke?
📖 Explanation: A duplicate ACK signals that a segment was likely lost. TCP’s fast retransmit algorithm reacts by retransmitting the suspected missing segment without waiting for the retransmission timer to expire, thereby accelerating loss recovery and maintaining data flow.
Q13. Evaluate the trade‑off between using a large TCP window size and the risk of buffer overflow in routers. Which statement best captures this relationship?
📖 Explanation: A large window permits more data to be in flight, which can saturate intermediate router buffers during congestion. If buffers overflow, packets are dropped, prompting retransmissions and potentially degrading performance. Hence, while larger windows can boost throughput, they must be balanced against the risk of inducing buffer overflows.
Q14. What role does the TCP window scale option play in modern high‑speed networks?
📖 Explanation: The window scale option extends the 16‑bit window field by applying a power‑of‑two multiplier, enabling window sizes far larger than 65 535 bytes. This capability is essential for high‑bandwidth, high‑latency links where the traditional limit would otherwise restrict throughput.
Q15. What range of port numbers is designated as well‑known ports?
📖 Explanation: Well‑known ports are defined by ICANN as the range from 0 to 1023. This range is reserved for standard services like HTTP (80) and DNS (53). Because it is centrally managed, these ports are universally recognized and cannot be arbitrarily assigned to other applications.
Q16. In UNIX systems, which file typically contains the mapping of service names to well‑known ports?
📖 Explanation: The file /etc/services stores static associations between symbolic service names and their corresponding port numbers. It is consulted by utilities such as grep to locate the port for a given service. The other listed files serve different purposes like user accounts, host resolution, or DNS configuration.
Q17. Which port number does the Trivial File Transfer Protocol (TFTP) commonly use?
📖 Explanation: TFTP is a simple file‑transfer protocol that traditionally operates on port 69. It can use either UDP or TCP, but UDP is most common. The other ports listed correspond to DNS (53), HTTP (80), and HTTPS (443), which are unrelated to TFTP.
Q18. If a server mistakenly registers a port in the well‑known range that is already assigned to another service, what is the most likely immediate effect on network traffic?
📖 Explanation: When two services attempt to bind to the same well‑known port, the operating system typically prevents the second binding and returns an error. Clients trying to connect will encounter a failure, often reported as a port‑conflict, because the expected service is unavailable.
Q19. Suppose an application moves from using a registered port (e.g., 15000) to a dynamic port (e.g., 50000) without updating its firewall rules. What inference can be drawn about subsequent connection failures?
📖 Explanation: Firewalls commonly have explicit rules for registered ports but may deny traffic to dynamic ports by default. When the application switches to a dynamic port without adjusting those rules, inbound packets are dropped, leading to connection failures. The OS does not auto‑open ports, and the application does not revert automatically.
Q20. Given that ICANN does not control dynamic ports, why might a security audit flag the use of port 50000 for a critical service?
📖 Explanation: Dynamic ports are not registered with ICANN, so they lack a globally recognized identity. An attacker can choose the same number for a malicious service, increasing the risk of spoofing or accidental collisions. Auditors therefore highlight unregistered ports for critical services as a potential security weakness.
Q21. If a network administrator observes that both TCP and UDP traffic are arriving on port 69, what deduction can be made about the underlying protocol usage?
📖 Explanation: Port 69 is the standard port for TFTP, which primarily uses UDP, but it is also permitted on TCP. Seeing traffic on both transport protocols indicates that the service is accepting connections via both UDP and TCP, suggesting a configuration that supports both variants of the protocol.
Q22. Assume two services, Service X on port 161 (SNMP) and Service Y on port 162, are both configured to listen on UDP. If a packet is sent to port 161 using TCP, what is the expected outcome?
📖 Explanation: SNMP and SNMP‑TRAP are defined to operate over UDP. When a packet arrives using TCP, the operating system does not deliver it to a UDP socket, so the packet is discarded. Neither service can process the mismatched transport protocol, resulting in the packet being dropped.
Q23. When a new application is deployed and requests a port number in the range 49,152–65,535, what can be concluded about the registration status of that port?
📖 Explanation: Ports from 49,152 to 65,535 are defined as dynamic ports. They are not controlled or registered by ICANN, allowing applications to use them temporarily or privately without needing an official assignment. Consequently, the requested port is unregistered and falls into the dynamic category.
Q24. If a firewall rule permits traffic to registered ports but denies dynamic ports, how will traffic to port 50,000 be treated?
📖 Explanation: Port 50,000 lies within the dynamic range (49,152–65,535). Since the firewall explicitly denies dynamic ports, any packet destined for that port—regardless of protocol—will be blocked, resulting in a denied connection.
Q25. Consider a scenario where a client resolves a service name to port 8080 using /etc/services. What logical error might arise if the administrator later changes the service to use port 8081 without updating the file?
📖 Explanation: The /etc/services file provides a static mapping. If the underlying service moves to a new port but the file is not updated, clients continue to request the old port (8080). Because the service no longer listens there, connection attempts fail until the mapping is corrected.
Q26. Compare the security implications of using a well‑known port versus a dynamic port for a proprietary service.
📖 Explanation: Dynamic ports are less likely to be targeted by automated scanners that focus on well‑known ports (0‑1023). By placing a proprietary service on a dynamic port, it gains a degree of obscurity, reducing the chance of opportunistic attacks, although it does not replace proper security controls.
Q27. Evaluate the impact on network manageability when an organization standardizes all internal services to use only registered ports instead of dynamic ports.
📖 Explanation: Limiting services to the registered range (1024‑49,151) creates a predictable set of ports, simplifying documentation and firewall rule creation. However, the finite pool may become crowded, forcing administrators to negotiate port assignments and potentially limiting the number of distinct services that can coexist without conflict.
Q28. Differentiate between the role of /etc/services and the IANA registry in assigning port numbers.
📖 Explanation: IANA (via ICANN) defines the official numerical ranges and assigns specific well‑known and registered ports. The /etc/services file, maintained locally on UNIX systems, maps human‑readable service names to those numbers for convenience. It does not perform registration; it merely reflects the assignments defined by the global registry.
Q29. Which of the following best explains why a well‑known port (e.g., 80) cannot be freely chosen for a new proprietary protocol?
📖 Explanation: Port 80 is officially assigned to HTTP. Selecting it for a different protocol would cause immediate conflicts with existing web traffic, leading to ambiguous routing and service disruption. Well‑known ports are reserved to ensure interoperability, so new protocols must choose unassigned ports.
Q30. Assess the advantage of registering a port in the registered range (1024‑49,151) for a commercial application versus using a dynamic port.
📖 Explanation: Registering a port provides a unique identifier that prevents accidental duplication across the Internet. It also allows network operators to create stable firewall rules, knowing the port will remain associated with the application. Dynamic ports lack this guarantee, making policy management more complex.
Q31. Identify the primary difference between a well‑known port and a dynamic port regarding control by ICANN.
📖 Explanation: ICANN (through IANA) assigns and manages the well‑known (0‑1023) and registered (1024‑49,151) ranges. Dynamic ports (49,152‑65,535) are left unregulated, allowing applications to select them without a formal registration process.
Q32. Given two services, one using port 161/UDP (SNMP) and another using port 162/UDP (SNMP‑TRAP), what can be inferred about their functional relationship?
📖 Explanation: Port 161 is the standard SNMP agent port, while port 162 is reserved for SNMP trap messages. Both belong to the same protocol family and are defined by IANA, indicating a closely related functional relationship—one for queries, the other for asynchronous notifications.
Q33. If an organization decides to migrate its legacy service from port 69 (TFTP) to a custom port 21000, what potential benefit does this migration provide?
📖 Explanation: Changing to a non‑standard port moves the service out of the well‑known range that many generic TFTP clients scan by default. This reduces the chance that another application will unintentionally bind to the same port, decreasing accidental collisions and improving operational stability.
Q34. Apply the principle of port range allocation: which range would you select for a temporary testing service that does not require registration?
📖 Explanation: A temporary or private service typically uses a dynamic port because it does not need to be registered and can be allocated quickly. The dynamic range (49,152–65,535) is intended for such short‑lived or experimental uses, avoiding the need for formal assignment.
Q35. Synthesize a policy that restricts outbound traffic to well‑known ports only. Which of the following statements best describes the effect on typical web browsing?
📖 Explanation: Web browsers primarily use HTTP (port 80) and HTTPS (port 443), both of which are well‑known ports. Restricting outbound traffic to well‑known ports therefore permits normal web browsing while potentially blocking applications that rely on higher‑numbered ports.
Q36. Explain why a network engineer might prefer to map a service name to a registered port in /etc/services rather than a dynamic port.
📖 Explanation: Using a registered port provides a stable, documented identifier that other administrators and tools can rely on. It reduces the risk of two applications inadvertently choosing the same port, which is more likely with dynamic ports that have no central coordination.