MODULE 4 Flashcards

(8 cards)

1
Q

User Datagram Packet (UDP) Format and Applications

A

UDP Format:
UDP is a simple, connectionless protocol that provides minimal transport-layer functionality. The format of a UDP packet includes four fields in its header, as depicted below:

The UDP header is 8 bytes in size, and there is no connection establishment, retransmission, or acknowledgment mechanism. The payload follows the header and contains the application data.

Applications of UDP:
UDP is used in scenarios where speed and simplicity are prioritized over reliability. Below are some common applications:

Real-Time Applications:

Video streaming (e.g., YouTube, Netflix) and audio streaming (e.g., Spotify) rely on UDP for faster data transmission without delays caused by retransmissions.
Online Gaming:

In gaming, real-time updates are critical. UDP is preferred as lost packets (e.g., missing positions or actions) are less significant than delay.
Voice over IP (VoIP):

UDP is used in VoIP systems (e.g., Skype, Zoom) for transmitting voice data quickly, allowing smooth communication.
Broadcasting and Multicasting:

Protocols such as DNS (Domain Name System) and DHCP (Dynamic Host Configuration Protocol) use UDP for broadcasting messages to multiple hosts simultaneously.
Simple Query-Response Protocols:

DNS requests are typically small and rely on UDP due to its low overhead and simplicity.
IoT Devices:

Internet of Things (IoT) devices often use UDP because of its lightweight nature, enabling quick communication over limited networks.
Advantages of UDP:

Low overhead due to smaller headers and lack of acknowledgment mechanisms.
Faster data transmission compared to connection-oriented protocols like TCP.
Disadvantages of UDP:

Lack of reliability as it does not guarantee delivery, ordering, or error recovery.
Susceptible to packet loss and duplication without retransmission mechanisms.
Conclusion:
UDP is a lightweight protocol ideal for applications requiring high speed and minimal delays, particularly in real-time and broadcasting scenarios. Its simplicity makes it efficient but unsuitable for applications demanding reliable data transfer.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Explain in detail about the three-way-handshake protocol for connection establishment in TCP.

A

Definition:
The three-way handshake is a process used by Transmission Control Protocol (TCP) to establish a reliable connection between a client and a server. It ensures proper synchronization of sequence numbers and confirms that both parties are ready for communication.

Steps Involved
Step 1: SYN (Synchronization Request)

The client sends a TCP segment with the SYN flag set to 1.
The packet contains the client’s Initial Sequence Number (ISN).
Purpose: To initiate the connection and inform the server about the client’s ISN.
Client State: SYN-SENT.
Step 2: SYN-ACK (Synchronization and Acknowledgment)

The server responds with a TCP segment having SYN = 1 and ACK = 1.
The packet includes the server’s ISN and an acknowledgment for the client’s ISN.
Acknowledgment Number: Client’s ISN + 1.
Server State: SYN-RECEIVED.
Step 3: ACK (Acknowledgment)

The client sends a final acknowledgment with ACK = 1.
The packet acknowledges the server’s ISN by setting the acknowledgment number to Server’s ISN + 1.
Client State: ESTABLISHED.
Server State: ESTABLISHED.

Significance
Ensures synchronization between client and server.
Confirms both parties are ready for data transfer.
Prevents communication errors such as duplicate or out-of-order packets.
Conclusion:
The three-way handshake is essential in TCP to establish a reliable and synchronized connection, ensuring smooth and error-free communication.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Explain flow control and error control mechanisms in TCP

A

TCP is a reliable, connection-oriented protocol that provides mechanisms to ensure smooth data transfer between sender and receiver. The flow control and error control mechanisms play a critical role in achieving this reliability.

  1. Flow Control in TCP
    Definition:
    Flow control is a mechanism to ensure that the sender does not overwhelm the receiver by sending more data than it can process or store in its buffer.

Mechanism: Sliding Window Protocol
TCP uses a sliding window protocol for flow control, which is dynamic and adjusts based on the receiver’s capacity.

Advertised Window:

The receiver specifies the size of its available buffer in the window field of the TCP header.
This is called the advertised window.
Dynamic Adjustment:

The sender monitors the size of the receiver’s advertised window and ensures that it does not send more data than the allowed window size.
Window Shrinking:

If the receiver’s buffer becomes full, it may shrink the advertised window to slow down or temporarily stop the sender.
Zero Window Advertisement:

If the receiver’s buffer is completely full, it sends a zero window notification, pausing data transmission.
The sender periodically sends window probe packets to check if space is available again.
2. Error Control in TCP
Definition:
Error control ensures the reliable delivery of data by detecting and recovering from errors such as lost, corrupted, or duplicate packets.

Mechanisms for Error Control
Checksum:

Each TCP segment includes a checksum field for detecting data corruption.
If a segment is corrupted, it is discarded by the receiver.
Acknowledgments (ACK):

TCP uses positive acknowledgments to confirm the successful receipt of data.
If the sender does not receive an acknowledgment within a specified timeout period, it retransmits the segment.
Retransmissions:

TCP uses a retransmission timer to resend lost or corrupted segments.
Sequence Numbers:

Each segment in TCP is assigned a sequence number, allowing the receiver to detect missing or out-of-order packets.
Duplicate Acknowledgments:

If a segment is lost, the receiver sends duplicate ACKs for the last correctly received segment.
The sender detects this and retransmits the missing segment.
Sliding Window for Error Recovery:

The sender maintains a window of segments that have been sent but not yet acknowledged.
On retransmission, only unacknowledged segments are resent.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Explain the TCP general policy for handling Congestion control.

A

Definition:
Congestion control in TCP is a mechanism to prevent excessive traffic from overwhelming the network, which can lead to packet loss, increased latency, and degraded performance. TCP’s congestion control policies dynamically adjust the data transmission rate to match the network’s capacity.

TCP Congestion Control Mechanisms
TCP implements congestion control using four key algorithms:

  1. Slow Start
    Purpose:
    Gradually increases the sending rate to avoid overwhelming the network.

Mechanism:

At the start of a connection, TCP initializes a variable called the congestion window (cwnd) to a small value (typically 1 Maximum Segment Size, MSS).
For every ACK received, the cwnd is doubled, effectively growing the transmission rate exponentially.
Slow start continues until:
The cwnd reaches the ssthresh (slow start threshold).
Packet loss is detected (via timeouts or duplicate ACKs).
2. Congestion Avoidance
Purpose:
Prevents congestion by increasing the sending rate more cautiously.

Mechanism:

Once the cwnd reaches the ssthresh, TCP switches from slow start to congestion avoidance.
Instead of exponential growth, the cwnd increases linearly:
For every round-trip time (RTT), cwnd increases by 1 MSS.
This ensures the network is not overloaded while still probing for additional bandwidth.
3. Fast Retransmit
Purpose:
Quickly retransmits lost packets without waiting for a timeout.

Mechanism:

When the sender receives three duplicate ACKs, it interprets this as an indication of a lost segment.
The sender immediately retransmits the missing segment without waiting for the retransmission timer to expire.
4. Fast Recovery
Purpose:
Avoids reducing the transmission rate drastically after packet loss.

Mechanism:

After retransmitting the missing segment, TCP temporarily reduces the cwnd by half instead of resetting it to 1 MSS.
The cwnd then grows linearly to probe the network for available capacity.
Key Terms in TCP Congestion Control
Congestion Window (cwnd):

A TCP state variable that controls the number of bytes a sender can send before waiting for an acknowledgment.
Slow Start Threshold (ssthresh):

A threshold value used to determine when to switch from slow start to congestion avoidance.
Retransmission Timeout (RTO):

If an acknowledgment is not received within this period, the segment is retransmitted, and the congestion window is reset.
Duplicate Acknowledgments:

Repeated acknowledgments for the same data segment, signaling packet loss.
Diagram of Congestion Control Phases
Slow Start: Exponential growth.
Congestion Avoidance: Linear growth.
Fast Retransmit/Recovery: Reduces congestion window after packet loss.

TCP Behavior on Congestion Detection
Timeout:

cwnd is reset to 1 MSS, and ssthresh is set to half the current cwnd.
The connection enters the slow start phase.
Duplicate ACKs:

Trigger fast retransmit and fast recovery.
cwnd is reduced by half, and the connection moves to the congestion avoidance phase.
Conclusion
TCP’s congestion control policies—slow start, congestion avoidance, fast retransmit, and fast recovery—allow it to adapt dynamically to network conditions. These mechanisms strike a balance between efficient bandwidth utilization and preventing congestion collapse, making TCP robust in various network environments.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define Segment? Explain the TCP Segment format

A

Segment in TCP
Definition:
A segment in TCP refers to the unit of data exchanged between the TCP layers of the sender and receiver. It consists of a header and the payload (application data), and it is encapsulated within an IP packet for transmission over the network.

TCP Segment Format
A TCP segment is divided into two main parts: the header and the data. The header contains essential control and metadata fields, while the data part contains the actual information being transmitted.

Key Fields in Detail
Sequence Number:

Helps reassemble data in the correct order at the receiver.
Acknowledgment Number:

Confirms the receipt of data by acknowledging the next expected byte.
Control Flags:

Important flags include:
SYN: Synchronize connection.
ACK: Acknowledge receipt of data.
FIN: Terminate connection.
RST: Reset connection.
PSH: Push data to the application layer immediately.
URG: Urgent data present.
Window Size:

Controls the flow of data by specifying the size of the receiver’s buffer.
Checksum:

Ensures data integrity by checking for errors in the header and payload.
Options:

Extends TCP functionality, e.g., defining the Maximum Segment Size (MSS).
Conclusion
A TCP segment is the core structure used in TCP communication, enabling reliable, ordered, and error-checked delivery of data. Its well-defined format ensures efficient transmission and control, making TCP suitable for diverse network applications.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain Stop-and-Wait protocol.

A

Definition:
The Stop-and-Wait Protocol is a simple communication protocol used in data transmission. In this protocol, the sender transmits one frame (or packet) at a time and waits for an acknowledgment (ACK) from the receiver before sending the next frame. This ensures reliable delivery of data but may result in inefficiencies on high-bandwidth or long-delay networks.

Working of the Stop-and-Wait Protocol
Sender Behavior:

The sender transmits a single frame and starts a timer.
The timer ensures that the sender retransmits the frame if an acknowledgment is not received within a specified timeout period.
Receiver Behavior:

The receiver checks for errors in the received frame using mechanisms like checksums.
If the frame is valid, the receiver sends an acknowledgment to the sender.
If the frame is corrupted, the receiver discards it, and no acknowledgment is sent.
Flow of Transmission:

If the sender receives the acknowledgment, it sends the next frame.
If no acknowledgment is received (due to loss or error), the sender retransmits the same frame after the timer expires.
Steps of the Stop-and-Wait Protocol
Data Transmission:

The sender sends frame F1 to the receiver.
Acknowledgment:

If the frame is successfully received, the receiver sends an acknowledgment (ACK1).
Timeout and Retransmission:

If no acknowledgment is received within the timeout period, the sender retransmits F1.
Features of Stop-and-Wait Protocol
Error Control:

Uses sequence numbers and acknowledgments to detect and recover from errors.
Flow Control:

Ensures the sender does not overwhelm the receiver by transmitting frames one at a time.
Simplicity:

The protocol is straightforward to implement, as it does not require complex mechanisms like sliding windows.
Advantages
Reliability:

Guarantees error-free and ordered delivery of frames.
Simple Implementation:

Easy to understand and implement, making it suitable for basic systems.
Disadvantages
Inefficiency:

Only one frame is sent at a time, leading to low utilization of network bandwidth, especially in high-latency or high-bandwidth networks.
Delays:

The waiting time for acknowledgment increases the overall transmission time.
Efficiency of Stop-and-Wait Protocol
The efficiency of the Stop-and-Wait Protocol depends on the bandwidth-delay product, which is the product of the network’s bandwidth and the round-trip time (RTT).

Efficiency Formula:
Efficiency
=
FrameTransmissionTime
FrameTransmissionTime
+
RTT
Efficiency=
FrameTransmissionTime+RTT
FrameTransmissionTime

As RTT increases, efficiency decreases, making this protocol unsuitable for long-distance or high-bandwidth links.
Conclusion
The Stop-and-Wait Protocol ensures reliable data transmission by using acknowledgment and retransmission mechanisms. While it is simple and guarantees ordered delivery, its inefficiency on high-bandwidth or long-delay networks makes it less practical for modern communication systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain the general UDP Services provided by the transport layer protocol.

A

Definition:
The User Datagram Protocol (UDP) is a connectionless transport layer protocol that provides basic and fast communication services. Unlike TCP, UDP focuses on simplicity and low overhead, making it ideal for applications that prioritize speed over reliability.

Services Provided by UDP
Process-to-Process Communication:

UDP enables communication between processes running on different hosts by using port numbers to identify source and destination applications.
Each process is associated with a unique port number, which is included in the UDP header for proper delivery.
Connectionless Service:

UDP does not establish a connection before sending data.
Each datagram is sent independently, which reduces setup time and overhead.
Minimal Overhead:

The UDP header is only 8 bytes, making it lightweight and suitable for fast transmission.
It does not include mechanisms for flow control, error control, or congestion control, reducing processing time.
Best-Effort Delivery:

UDP does not guarantee reliable delivery, ordering, or data integrity.
It relies on the application layer to handle any necessary retransmissions or error corrections.
Checksum for Error Detection:

UDP includes an optional checksum field for basic error detection.
If enabled, it ensures that the header and data are not corrupted during transmission.
Broadcast and Multicast Support:

UDP supports broadcasting and multicasting, allowing data to be sent to multiple hosts simultaneously.
This makes it ideal for applications like video streaming and online gaming.
Support for Small Transactions:

UDP is efficient for small data exchanges, such as DNS queries and responses, due to its lightweight nature.
Low Latency Communication:

UDP is designed for applications that require minimal delay, such as voice calls, video calls, and live streaming.
Applications of UDP Services
Real-Time Applications:

VoIP (Voice over IP), online gaming, and live video streaming utilize UDP for its low latency.
Domain Name System (DNS):

DNS uses UDP for fast query-response exchanges, ensuring quick resolution of domain names to IP addresses.
Dynamic Host Configuration Protocol (DHCP):

UDP is used to send configuration information between DHCP clients and servers.
Simple Network Management Protocol (SNMP):

UDP is used to manage network devices because it requires minimal resources.
Routing Protocols:

Protocols like RIP (Routing Information Protocol) use UDP to exchange routing information efficiently.
Advantages of UDP Services
Speed:

The absence of connection setup and minimal headers makes UDP fast.
Efficiency:

Lightweight design and low overhead make UDP ideal for resource-constrained systems.
Broadcast and Multicast Capabilities:

Supports simultaneous communication with multiple hosts.
Disadvantages of UDP Services
Unreliable Delivery:

UDP does not guarantee packet delivery or order, requiring applications to handle such tasks.
No Congestion Control:

UDP does not manage network congestion, which can lead to packet loss.
No Flow Control:

Without flow control, the sender may overwhelm the receiver.
Conclusion
The services provided by UDP make it suitable for applications where speed and efficiency are critical, and reliability is handled at the application layer. While it lacks the robustness of TCP, its low overhead and support for broadcasting and multicasting make it indispensable for real-time and lightweight communication scenarios.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain Send-Receiver Window of Go-Back-N Protocol.

A

The Go-Back-N (GBN) Protocol is a sliding window protocol used in reliable data transfer. It allows the sender to transmit multiple frames before needing an acknowledgment, thereby improving efficiency. The protocol employs send and receive windows to manage the flow and sequencing of data.

  1. Send Window
    The send window is a conceptual sliding window maintained by the sender to keep track of the frames that have been sent but not yet acknowledged.

Features of the Send Window:
Size:

The size of the send window is 2^m - 1, where m is the number of bits in the sequence number.
This ensures no ambiguity in identifying frames, even after retransmissions.
Structure:

The window consists of:
Frames sent and acknowledged: Removed from the window.
Frames sent but not acknowledged: Remain in the window.
Frames not yet sent: Await acknowledgment to move the window forward.
Sliding Behavior:

The window slides forward as acknowledgments are received for the oldest outstanding frames.
For example, if an acknowledgment for frame k is received, all frames up to k are removed from the window.
Unacknowledged Frames:

If an acknowledgment is not received before the timer expires, the sender retransmits all outstanding frames in the window, starting from the oldest unacknowledged frame.
Send Window Variables:
Sf: Sequence number of the first outstanding (unacknowledged) frame.
Sn: Sequence number of the next frame to be sent.
Ssize: Maximum size of the send window (2^m - 1).
2. Receive Window
The receive window is a sliding window maintained by the receiver to track the sequence of frames it expects to receive.

Features of the Receive Window:
Size:

The size of the receive window is always 1 in the GBN protocol.
This means the receiver only accepts the next expected frame in sequence.
Handling Out-of-Order Frames:

If a frame arrives out of order, it is discarded, and the receiver sends an acknowledgment for the last correctly received frame.
Sliding Behavior:

The receive window slides forward only when the correct frame (the one with the expected sequence number) is received.
Acknowledgment Mechanism:

For every correctly received frame, the receiver sends a cumulative acknowledgment indicating the next expected frame.
Receive Window Variables:
Rn: Sequence number of the next expected frame.
Frames outside the window (either already received or not yet expected) are discarded.
Example of Send and Receive Window Behavior
Scenario:
Window Size (Ssize): 4 (m = 3, 2^m - 1 = 7).
Initial State:
Sender: Sf = 0, Sn = 0.
Receiver: Rn = 0.
Sender Sends Frames 0, 1, 2, 3:

Frames are sent consecutively, and Sn is updated after each transmission.
Receiver Receives Frames 0, 1, 2:

The receiver sends cumulative acknowledgments (e.g., ACK3 for frames 0–2).
Frame 3 Is Lost:

The sender does not receive ACK4, and the timer for frame 3 expires.
Sender retransmits frames 3, 4, and 5.
Window Sliding:

Upon acknowledgment of frame 3, Sf and Rn slide forward, allowing new transmissions and receptions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly