Unit 5: Transport layer - Subjective Questions
CAP7001 — Data Communication And Networking • Practice Questions with Detailed Answers
20 questions
Define a port address. Explain its role in process-to-process communication and describe the major ranges of port numbers.
A port address, or port number, is a 16-bit logical address used by the transport layer to identify a specific application process running on a host. While an IP address identifies a device, a port number identifies the source or destination process within that device.
The valid port-number range is to .
- Well-known ports (0–1023): Reserved for standard services, such as HTTP on port 80, HTTPS on port 443, and DNS on port 53.
- Registered ports (1024–49151): Assigned to particular applications or services upon registration.
- Dynamic or private ports (49152–65535): Usually selected temporarily by client applications.
At the sender, the transport layer adds source and destination port numbers to a segment. At the receiver, the destination port number enables demultiplexing, directing the data to the correct application process.
What is a socket address? Distinguish between an IP address, a port address, and a socket address with an example.
A socket address uniquely identifies one endpoint of process-to-process communication. It consists of an IP address combined with a port number:
For example, 192.168.1.10:5000 is a socket address.
- IP address: Identifies a host or network interface, such as
192.168.1.10. - Port address: Identifies an application process on that host, such as port
5000. - Socket address: Identifies the complete communication endpoint, such as
192.168.1.10:5000.
A transport-layer connection is normally identified by two socket addresses: the source socket address and the destination socket address. A TCP connection can therefore be represented by the four-tuple (source IP, source port, destination IP, destination port).
Explain the transport-layer processes of multiplexing and demultiplexing using port numbers.
Multiplexing and demultiplexing allow multiple applications to use the network simultaneously.
-
Multiplexing at the sender:
- The transport layer accepts data from several application processes.
- It adds a transport-layer header containing source and destination port numbers.
- It passes the resulting segments or datagrams to the network layer.
-
Demultiplexing at the receiver:
- The transport layer receives packets from the network layer.
- It examines the destination port number in each transport-layer header.
- It delivers the payload to the appropriate application process.
For example, a host may simultaneously use a web browser and an email client. Their different socket addresses allow incoming data to be delivered to the correct applications. Thus, port numbers provide process-to-process delivery, whereas IP addresses provide host-to-host delivery.
Describe the User Datagram Protocol (UDP) and explain its major characteristics, advantages, and limitations.
User Datagram Protocol (UDP) is a connectionless transport-layer protocol that sends independent messages called user datagrams.
Major characteristics:
- It does not establish a connection before transmitting data.
- It provides no acknowledgments, retransmissions, sequencing, flow control, or congestion control.
- Each datagram is handled independently.
- It has a small fixed header of 8 bytes.
- It uses a checksum for error detection, but it does not recover from detected errors.
- It preserves message boundaries.
Advantages:
- Low protocol overhead
- Small communication delay
- Simple implementation
- Support for broadcast and multicast
- Suitable for real-time and request-response applications
Limitations:
- Datagrams may be lost, duplicated, corrupted, or delivered out of order.
- Reliability must be implemented by the application when required.
UDP is commonly used by DNS, DHCP, online gaming, voice communication, and live multimedia streaming.
Draw conceptually and explain the fields of a UDP header. How is the UDP length field calculated?
A UDP header has a fixed size of 8 bytes and contains four 16-bit fields:
| Field | Size | Purpose |
|---|---|---|
| Source port | 16 bits | Identifies the sending process; it may be zero when a reply is not expected. |
| Destination port | 16 bits | Identifies the receiving process. |
| Length | 16 bits | Gives the total size of the UDP header and data in bytes. |
| Checksum | 16 bits | Detects errors in the header and data. |
The length is calculated as:
Since the header is 8 bytes:
For example, if UDP carries 500 bytes of application data, the value of the length field is bytes. The minimum UDP length is therefore 8 bytes.
Explain how the UDP checksum is generated and verified. What is the purpose of the pseudo-header?
The UDP checksum provides end-to-end error detection for the UDP header and payload.
Checksum generation:
- A pseudo-header is formed using selected IP-layer information.
- The UDP header is included with its checksum field initially set to zero.
- The UDP data is appended; a padding byte of zero is added if the total number of bytes is odd.
- All 16-bit words are added using one's-complement arithmetic.
- The one's complement of the sum is stored in the checksum field.
Verification: The receiver performs one's-complement addition over the pseudo-header, UDP header, data, and received checksum. An error-free result should consist entirely of binary ones.
The pseudo-header normally contains source and destination IP addresses, the protocol number, and UDP length. It is not transmitted as part of the UDP datagram. Its purpose is to detect delivery to an incorrect host or transport protocol in addition to detecting corruption in the UDP header and data.
Describe the Transmission Control Protocol (TCP) and explain the services it provides to applications.
Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream transport protocol.
TCP provides the following services:
- Connection-oriented communication: A logical connection is established before data transfer and closed afterward.
- Reliable delivery: Lost or corrupted segments are detected and retransmitted.
- Ordered delivery: Sequence numbers enable bytes to be delivered to the application in the original order.
- Byte-stream service: TCP treats application data as a continuous stream of bytes rather than preserving message boundaries.
- Full-duplex communication: Both endpoints can send and receive simultaneously.
- Flow control: The receiver advertises a window to prevent the sender from overwhelming its buffer.
- Error control: Checksums, acknowledgments, timers, and retransmissions handle transmission errors.
- Congestion control: TCP adjusts its sending rate according to perceived network congestion.
- Process addressing: Port numbers identify the communicating applications.
TCP is used by applications such as web browsing, email, file transfer, and remote login where reliable delivery is important.
Explain the important fields of a TCP segment header and state the function of each field.
The TCP header has a minimum size of 20 bytes and may extend to 60 bytes when options are present.
- Source and destination ports: Identify the sending and receiving application processes.
- Sequence number: Identifies the number of the first data byte carried in the segment.
- Acknowledgment number: Indicates the next byte expected from the other endpoint.
- Data offset: Specifies the TCP header length and hence the starting position of data.
- Control flags: Include
SYN,ACK,FIN,RST,PSH, andURG, which control connection establishment, acknowledgment, termination, reset, and data handling. - Window size: Advertises the number of bytes the receiver is currently prepared to accept.
- Checksum: Detects errors in the TCP header and data using an IP pseudo-header.
- Urgent pointer: Identifies the end of urgent data when the
URGflag is set. - Options: Support features such as maximum segment size, window scaling, selective acknowledgment, and timestamps.
- Padding: Makes the header length a multiple of 32 bits.
Together, these fields support reliable, ordered, flow-controlled communication.
Compare TCP and UDP with respect to connection management, reliability, header size, speed, data handling, and applications.
| Basis | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented | Connectionless |
| Reliability | Reliable using acknowledgments and retransmissions | No guarantee of delivery |
| Ordering | Delivers bytes in order | Datagrams may arrive out of order |
| Data model | Continuous byte stream | Message-oriented datagrams |
| Header size | Minimum 20 bytes | Fixed 8 bytes |
| Flow control | Provided using the receiver window | Not provided |
| Congestion control | Provided | Not provided by UDP itself |
| Error handling | Detection and recovery | Detection through checksum, without recovery |
| Broadcast or multicast | Not supported directly | Supported |
| Overhead and delay | Comparatively higher | Comparatively lower |
| Typical uses | HTTP/HTTPS, email, file transfer, SSH | DNS, DHCP, streaming, gaming, voice traffic |
TCP should be selected when accurate and ordered delivery is essential. UDP is suitable when low delay, message boundaries, broadcast or multicast support, or application-controlled reliability is more important.
Explain TCP's three-way handshaking process for connection establishment using sequence and acknowledgment numbers.
TCP uses a three-way handshake to synchronize sequence numbers, confirm that both endpoints are ready, and negotiate connection parameters.
Assume the client selects initial sequence number and the server selects .
-
Client to server — SYN:
- The client sends a segment with
SYN = 1and sequence number . - The client enters the
SYN-SENTstate.
- The client sends a segment with
-
Server to client — SYN + ACK:
- The server sends
SYN = 1,ACK = 1, sequence number , and acknowledgment number . - This acknowledges the client's SYN and supplies the server's initial sequence number.
- The server sends
-
Client to server — ACK:
- The client sends
ACK = 1, sequence number , and acknowledgment number . - Both endpoints then enter the
ESTABLISHEDstate.
- The client sends
A SYN consumes one sequence number even if it contains no application data. The process verifies two-way reachability and prevents delayed connection requests from being mistaken for fully established connections.
Why does TCP require a three-way handshake instead of a two-way handshake? Discuss the problems prevented by the third message.
A two-way handshake would allow a server to send a confirmation after receiving a client's connection request, but the server would not know whether its own response and initial sequence number had successfully reached the client.
The third message is necessary because it:
- Confirms that the client received the server's
SYN. - Acknowledges the server's initial sequence number.
- Verifies bidirectional communication.
- Ensures that both endpoints agree that the connection has been established.
- Helps distinguish a new request from a delayed duplicate
SYNleft in the network. - Prevents the server from maintaining a fully established connection when the client is unaware of it.
In the third step, the client sends an acknowledgment number equal to the server's sequence number plus one. Thus, the three-way handshake synchronizes both sequence spaces and confirms that messages can travel successfully in both directions.
Describe TCP flow control using the sliding-window mechanism. How does it differ from congestion control?
TCP flow control prevents a fast sender from overwhelming a slow receiver. The receiver places an advertised receive-window value, commonly denoted by , in each acknowledgment. This value indicates the amount of additional data that the receiver can currently buffer.
The sender may have multiple bytes in transit, but the unacknowledged data must remain within the permitted send window. As the receiver processes data and sends acknowledgments, the window moves forward, producing a sliding-window mechanism. If the receiver advertises a zero window, the sender temporarily stops normal transmission and later uses window probes to discover when space becomes available.
Difference from congestion control:
- Flow control protects the receiving host and is governed by .
- Congestion control protects the network and is governed by the congestion window .
The sender's practical transmission limit is:
Thus, TCP obeys both receiver capacity and network capacity.
Define network congestion. Explain its causes, symptoms, and consequences.
Network congestion occurs when the offered traffic load exceeds the available capacity of network resources such as links, routers, queues, or processing units.
Common causes:
- Too many senders transmitting at high rates
- Limited link bandwidth
- Insufficient router buffer space
- Slow router processing
- Bursty traffic
- Unnecessary retransmissions
- Poor routing decisions or bottleneck links
Symptoms:
- Increasing queue lengths
- Long packet delays and delay variation
- Buffer overflow and packet loss
- Frequent retransmissions
- Reduced acknowledgment rate
- Router or link utilization near capacity
Consequences:
- Lower useful throughput or goodput
- Increased response time
- Wasted bandwidth due to retransmissions
- Unfair allocation among traffic flows
- In extreme cases, congestion collapse, where heavy load produces very little useful delivery
Congestion control attempts to match the aggregate sending rate to available network capacity before overload becomes severe.
Explain TCP congestion control using slow start and congestion avoidance. Include the roles of and .
TCP controls its sending rate using a congestion window, , and a slow-start threshold, .
Slow start:
- TCP begins with a relatively small .
- For each acknowledgment received, increases.
- Over one round-trip time, the window approximately doubles, producing exponential growth.
- Slow start continues until reaches or congestion is detected.
Congestion avoidance:
- When , TCP changes to slower, approximately linear growth.
- The window increases by roughly one maximum segment size per round-trip time.
- This follows the additive increase principle.
When congestion is detected through a timeout, a conventional response is:
The congestion window is then reduced substantially, and slow start is resumed. By increasing cautiously and decreasing after congestion, TCP probes for available bandwidth while attempting to avoid persistent overload.
Explain fast retransmit and fast recovery in TCP. How do they improve performance compared with waiting for a timeout?
Fast retransmit allows TCP to infer packet loss before the retransmission timer expires. When a receiver obtains an out-of-order segment, it normally repeats the acknowledgment for the next expected byte. If the sender receives three duplicate acknowledgments, it assumes that the indicated segment has been lost and retransmits it immediately.
Fast recovery prevents the sender from returning all the way to the smallest congestion window after this type of loss. In a traditional implementation:
- is set to approximately half of the current flight size.
- The lost segment is retransmitted.
- The congestion window is temporarily adjusted to account for duplicate acknowledgments.
- When an acknowledgment covering the retransmitted data arrives, is set near .
- TCP continues in congestion avoidance rather than restarting with full slow start.
These mechanisms improve performance because duplicate acknowledgments indicate that segments are still moving through the network. Therefore, the network is congested but has not become completely unresponsive, making a full timeout-based restart unnecessarily conservative.
Define Quality of Service (QoS) and explain the principal QoS parameters used to evaluate network performance.
Quality of Service (QoS) refers to a network's ability to provide predictable or differentiated performance to selected applications, users, or traffic flows.
Principal QoS parameters include:
- Bandwidth: The data-carrying capacity available to a flow, usually measured in bits per second.
- Throughput: The actual rate at which data is successfully delivered.
- Delay or latency: The time required for a packet to travel from source to destination. It includes processing, queuing, transmission, and propagation delays.
- Jitter: Variation in packet delay. It is especially important for voice and video traffic.
- Packet loss: The percentage of packets that fail to reach the destination.
- Reliability: The ability to deliver data correctly and consistently.
- Availability: The proportion of time for which the network service remains operational.
Different applications require different combinations. File transfer generally emphasizes reliability and throughput, while interactive voice emphasizes low delay, low jitter, and low loss.
Derive the main components of end-to-end packet delay and explain how each component affects QoS.
The approximate end-to-end delay across a path containing multiple links and routers can be expressed as:
The components are:
- Processing delay, : Time required to inspect headers, detect errors, and select an outgoing interface.
- Queuing delay, : Time spent waiting in router queues. It varies with traffic load and is a major source of jitter.
- Transmission delay, : Time required to place all packet bits onto the link. For packet length bits and link rate bits per second:
- Propagation delay, : Time for the signal to travel over the medium. For distance and propagation speed :
QoS can be improved by faster equipment, increased bandwidth, suitable queue management, geographically shorter routes, and traffic prioritization.
Explain how traffic shaping improves QoS. Compare the leaky-bucket and token-bucket techniques.
Traffic shaping regulates the rate at which packets enter a network. It reduces sudden bursts, limits congestion, and makes traffic behavior more predictable.
Leaky-bucket technique:
- Incoming packets are placed in a finite queue or bucket.
- Packets leave at a fixed rate.
- Excess packets are discarded when the bucket is full.
- It converts bursty input into a smooth, nearly constant output.
- It does not preserve large idle-time credits for future bursts.
Token-bucket technique:
- Tokens are generated at rate and stored up to capacity .
- Sending a packet consumes tokens according to its size.
- If sufficient tokens exist, packets may be transmitted immediately.
- Long-term traffic is limited to approximately rate , while bursts up to the stored-token capacity are permitted.
Comparison: The leaky bucket enforces a rigid output rate, whereas the token bucket controls the average rate while allowing bounded bursts. Token bucket is therefore more flexible for multimedia and variable-rate traffic.
Discuss different packet scheduling and queue-management techniques used to improve QoS.
Packet scheduling determines the order in which queued packets are transmitted. Important techniques include:
- First-In, First-Out (FIFO): Packets are sent in arrival order. It is simple but offers no service differentiation.
- Priority queuing: High-priority traffic is served before low-priority traffic. It benefits delay-sensitive traffic but may starve lower-priority queues.
- Round Robin: Each queue is served in turn. It improves fairness when packets or service requirements are similar.
- Weighted Round Robin: Queues receive service in proportion to assigned weights, allowing differentiated bandwidth allocation.
- Weighted Fair Queuing: Approximates fair sharing among flows while supporting different service weights.
Queue management also affects QoS:
- Tail drop discards new packets when the queue is full.
- Active Queue Management, such as Random Early Detection, drops or marks some packets before overflow to signal congestion early.
Effective scheduling and queue management reduce delay, jitter, loss, and unfairness while protecting important traffic classes.
Describe major techniques used to improve QoS, including classification, resource reservation, admission control, policing, shaping, scheduling, and congestion avoidance.
QoS improvement requires coordinated mechanisms across network devices:
- Traffic classification and marking: Packets are identified by application, address, port, or protocol and marked into service classes.
- Resource reservation: Bandwidth and buffer resources are reserved for selected flows when guaranteed service is required.
- Admission control: A new flow is accepted only if the network can satisfy its requirements without harming existing commitments.
- Traffic policing: Traffic is measured against a contract; excess traffic may be dropped, delayed, or re-marked.
- Traffic shaping: Bursty traffic is buffered and released at a controlled rate using leaky-bucket or token-bucket methods.
- Packet scheduling: Priority, weighted, or fair-queuing algorithms determine transmission order and bandwidth share.
- Congestion avoidance: Early dropping or explicit congestion notification warns senders before queues overflow.
- Overprovisioning: Additional link capacity and buffer resources reduce the probability of overload.
- Error control and redundancy: Retransmission, forward error correction, and path redundancy improve reliability.
- Jitter buffering: Receivers temporarily buffer multimedia packets to smooth delay variation.
The appropriate combination depends on whether the application prioritizes bandwidth, reliability, low delay, low jitter, or low loss.
Define a port address. Explain its role in process-to-process communication and describe the major ranges of port numbers.
A port address, or port number, is a 16-bit logical address used by the transport layer to identify a specific application process running on a host. While an IP address identifies a device, a port number identifies the source or destination process within that device.
The valid port-number range is to .
- Well-known ports (0–1023): Reserved for standard services, such as HTTP on port 80, HTTPS on port 443, and DNS on port 53.
- Registered ports (1024–49151): Assigned to particular applications or services upon registration.
- Dynamic or private ports (49152–65535): Usually selected temporarily by client applications.
At the sender, the transport layer adds source and destination port numbers to a segment. At the receiver, the destination port number enables demultiplexing, directing the data to the correct application process.
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →