đ TCP features in transport layer protocol (14 MCQs)
Full-Duplex Connection-Oriented Stream Service
TCP provides a connection-oriented, full-duplex, point-to-point byte stream at the transport layer. Each connection is identified by source and destination IP addresses and port numbers. TCP supports multiplexed application sessions, reliable delivery, sequencing, error detection, receiver flow control, and network congestion control, while IP remains responsible for forwarding segments between hosts. It defines the boundary between application processes and packet delivery.
Combining Application Semantics with Network Constraints
Applications need communication that can recover from packet loss and reordering, while receivers have finite buffers and networks have finite capacity. TCP combines end-to-end reliability with separate controls for receiver capacity and network congestion. Its stream abstraction also removes the need for applications to manage IP packet boundaries during ordinary data transfer.
Connection State and Sending Controls
A TCP endpoint tracks sequence and acknowledgment numbers, connection state, retransmission timers, and negotiated options. It sends only within limits imposed by the receiver's advertised window and its congestion window. Checksums detect corruption, while acknowledgments and retransmissions provide recovery. The operating system maps the connection's address-and-port tuple to a socket.
Full-Duplex Exchange Between Two Hosts
Host A opens TCP connection to host B using source port 51000 and destination port 443. After setup, both endpoints can send data independently in each direction, each maintaining its own sequence space and receive window. The same connection carries an ordered stream in each direction rather than one-way datagrams.
Capabilities and Performance Trade-Offs
TCP's reliability and flow regulation suit transactions, remote shells, and files, but connection state and head-of-line blocking can affect latency. Congestion control helps share capacity fairly, while receive-window flow control protects memory. TCP does not encrypt payloads by itself; protocols such as TLS add confidentiality and peer authentication above it.
Avoiding Confusion Between TCP Capabilities
'Flow control and congestion control are the same' is false: one protects the receiver and the other the network. 'TCP is encrypted by default' is false: encryption requires a higher-layer protocol such as TLS. 'TCP sends one segment per application write' is false: buffering and segmentation determine actual segment boundaries.
Exam Focus: Separate Reliability, Flow and Congestion
Classify TCP features into connection management, reliable delivery, byte sequencing, receiver flow control, and congestion control. Explain full-duplex operation and the four values identifying a connection. Compare TCP with UDP, and identify why TLS is needed when confidentiality and authentication are required. Use the assumptions stated in each question when calculating.
Key Terms for TCP Features in the Transport Layer Protocol
- Full duplex - Both endpoints send independently.
- Four-tuple - Source and destination address-port values.
- Flow control - Protects the receiver buffer.
- Congestion control - Regulates load on the network path.
- Head-of-line blocking - Later bytes wait behind a gap.
- TLS - Adds cryptographic protection above TCP.
đ All TCP features in transport layer protocol MCQs
Q1. If a client sends a TCP segment to destination port 80 but the server is listening on port 8080, what is the most likely outcome?
đ Explanation: When the server does not have a socket bound to portâŻ80, the SYN packet is not accepted. The serverâs TCP stack typically discards the packet or replies with an RST, but many firewalls simply drop it. Consequently the client waits for retransmissions until its timeout expires, yielding no connection.
Q2. A client behind NAT selects a dynamic source port 50000. The server replies using the same source port number as destination. Why does this allow the NAT device to forward the packet correctly?
đ Explanation: NAT devices create a temporary translation entry when the outbound SYN is sent, recording the internal IPâŻ:âŻ50000 and the external IPâŻ:âŻassigned port. When the server replies, the packetâs destination port matches the external port recorded in the table, enabling the NAT to translate it back to the internal address and port.
Q3. If a server process binds to a wellâknown port 53 but also opens a second socket on a dynamic port for the same client, what inference can be made about the server's design?
đ Explanation: Opening an additional dynamic socket for each client indicates that the server separates control traffic (on the wellâknown port) from data traffic (on a perâclient dynamic port). This design, known as multiplexing, allows concurrent handling of many clients while preserving a single wellâknown entry point for service discovery.
Q4. Suppose an application mistakenly uses a registered port range (e.g., 5000) for a wellâknown service, while another application uses the official wellâknown port for a different service. What networkâlevel conflict arises, and how does TCP resolve it?
đ Explanation: When two distinct services compete for the same port number, a receiving host cannot unambiguously map incoming segments to the correct process. TCP resolves this by sending a reset (RST) for packets that cannot be matched to an existing socket, effectively rejecting the ambiguous connection attempt.
Q5. Compare the role of the destination port number in TCP with the destination IP address. Which statement best captures their relationship?
đ Explanation: The destination IP address determines which physical or virtual machine should receive the packet, directing it through the network layer. Once the packet reaches that machine, the destination port number tells the transport layer which application or process should handle the data, providing processâlevel demultiplexing.
Q6. Evaluate the advantage of using wellâknown ports (0â1023) for standard services versus using dynamic ports for the same services. Which advantage is most significant?
đ Explanation: Wellâknown ports are universally recognized, allowing administrators to create concise firewall policies that permit or deny traffic based on a small, predictable set of port numbers. This predictability reduces configuration errors and eases auditing, which is a more impactful benefit than any marginal performance or addressâspace considerations.
Q7. Differentiate between a socket address and a port number alone. Which of the following statements is accurate?
đ Explanation: A socket address uniquely identifies an endpoint for a transportâlayer connection by pairing the hostâs IP address with the specific port number used by the application. A port number by itself lacks host context, so it cannot distinguish between identical ports on different machines.
Q8. Analyze why TCP requires both client and server socket addresses to be known before establishing a connection, whereas UDP can send datagrams without a prior handshake. Which principle best explains this requirement?
đ Explanation: TCP guarantees reliable, ordered delivery, which necessitates establishing state at both ends. Knowing both socket addresses enables the exchange of SYN, SYNâACK, and ACK packets that negotiate sequence numbers, window sizes, and other parameters essential for dependable communication. UDP lacks these guarantees and therefore can transmit without such a handshake.
Q9. Apply the concept of socket addressing: If a client at 192.168.1.10:34567 contacts a server at 203.0.113.5:80, what is the complete set of four values needed to uniquely identify the TCP connection?
đ Explanation: A TCP connection is uniquely defined by the tuple (clientâŻIP, clientâŻport, serverâŻIP, serverâŻport). This fourâelement combination distinguishes one connection from all others, even if multiple connections share the same client or server address individually.
Q10. Explain how the threeâway handshake utilizes socket addresses to establish a TCP connection. Which step correctly pairs the socket addresses?
đ Explanation: During the SYN, the client sends its own IP and chosen source port together with the serverâs IP and destination port. The server replies with a SYNâACK that mirrors both addresses and ports, confirming receipt. Finally, the clientâs ACK again carries the full socket pair, ensuring both sides have a consistent view of the connection endpoints.
Q11. Synthesize a scenario where a server uses both a wellâknown port and a dynamic port for a single client session. What is the most likely purpose of the dynamic port?
đ Explanation: Many protocols (e.g., FTP) employ a control channel on a wellâknown port and open a separate dynamic data channel for each client. The dynamic port isolates the bulk data transfer, allowing the wellâknown port to remain free for command exchange and reducing interference between control and data streams.
Q12. Given the socket address definition \\\text{socket address}= (\\text{IP address}, \\text{port number})\, derive how NAT translation modifies the clientâs socket address and discuss the impact on endâtoâend reliability guarantees of TCP.
đ Explanation: When a packet traverses NAT, the device substitutes the clientâs private IP with its public IP and typically assigns a new, unique external port. TCPâs reliability mechanismsâsequence numbers, checksums, and acknowledgmentsâoperate on the payload and are indifferent to the address translation, ensuring the connection remains reliable despite the intermediate modification.
Q13. What is the range of wellâknown ports defined by IANA?
đ Explanation: IANA designates the wellâknown port range as 0 through 1023. These ports are reserved for core services such as HTTP (80), FTP (21), and DNS (53), and they are typically bound by privileged processes on a host.
Q14. Define a socket address in the context of TCP.
đ Explanation: A socket address pairs a hostâs network layer identifier (its IP address) with a transportâlayer identifier (the port number). This tuple uniquely identifies one endpoint of a TCP connection, enabling the protocol to demultiplex incoming segments to the correct application process.