CN - Unit3 - Notes GTU
CN - Unit3 - Notes GTU
● Concept:
○ Multiplexing: Combining data from multiple applications for transport over a single
link.
○ Demultiplexing: Directing incoming data segments to the correct application at the
destination.
● Mechanism:
○ Each segment contains Source and Destination IP addresses and Port Numbers.
○ The transport layer at the destination uses IP and port numbers to forward the
segment to the correct application socket.
● Characteristics of UDP:
○ No handshaking between sender and receiver.
○ No connection state tracking, meaning no retransmissions or acknowledgments.
○ Simple, with minimal overhead.
5. UDP Checksum
● Reliable Data Transfer (rdt): Ensures accurate and in-order delivery of data.
● Unidirectional Data Transfer:
○ Control Information flows in both directions.
○ Uses Finite State Machines (FSMs) to manage state changes in the sender and
receiver.
○ Purpose: Introduces error detection to handle channels that might flip bits (i.e.,
cause errors in packets).
○ How it Works:
■ Adds checksum to detect errors in packets.
■ Uses ACKs (Acknowledgments) and NAKs (Negative
Acknowledgments):
● ACK: Sent by the receiver to confirm a packet arrived without errors.
● NAK: Sent if the receiver detects an error in the packet.
■ When the sender receives an ACK, it sends the next packet. If it receives a
NAK, it retransmits the same packet.
○ Limitations: Still does not handle lost packets. Only suitable for channels with
occasional bit errors.
○ Summary: Introduces error detection with ACK/NAK feedback, but does not handle
lost packets.
○ Purpose: Enhances rdt 2.0 to handle duplicate packets caused by ACK/NAK errors
or re-transmissions.
○ How it Works:
■ Adds sequence numbers to packets (typically 0 and 1) to help the receiver
identify duplicates.
■ If an ACK or NAK is corrupted, the sender doesn’t know if the packet arrived
correctly, so it retransmits.
■ The receiver checks the sequence number:
● If it’s a new packet, it accepts and acknowledges it.
● If it’s a duplicate (same sequence number as before), it discards it
and sends an ACK for the last correctly received packet.
○ Limitations: Still has limited handling for packet loss. Extra logic is required to deal
with duplicate packets.
○ Summary: Adds sequence numbers to identify duplicates, improving reliability over
channels with occasional bit errors.
Concept: Allows sending multiple packets without waiting for an acknowledgment for each one.
○ Concept: In Selective Repeat, the sender also sends multiple packets at once, but it
only retransmits individual packets that are lost or contain errors rather than
retransmitting the entire window.
○ How It Works:
■ Similar to Go-Back-N, the sender has a window size and can send several
packets without waiting for an acknowledgment.
■ The receiver sends an acknowledgment (ACK) for each packet it receives,
even if packets are received out of order.
■ If a packet is received out of order, the receiver buffers it until it can fill in any
gaps (e.g., if it receives packets 1 and 3 but is missing packet 2, it waits for
packet 2 and keeps packet 3 in the buffer).
■ If a packet is lost or contains an error, the sender only retransmits the
specific packet that was not acknowledged, rather than the entire window.
○ Example:
■ Suppose the window size is 4, and the sender sends packets 1, 2, 3, and 4.
■ If packet 2 is lost but packets 1, 3, and 4 are received correctly, the receiver
will acknowledge packets 1, 3, and 4 individually.
■ The sender, noticing the missing acknowledgment for packet 2, will only
retransmit packet 2.
■ Once packet 2 is received, the receiver can deliver the packets in the correct
order (1, 2, 3, 4).
○ Pros and Cons:
■ Pros: More efficient than Go-Back-N because only the lost or erroneous
packets are retransmitted.
■ Cons: More complex to implement since the receiver must be able to handle
out-of-order packets and buffer them.
○ Summary: Selective Repeat allows the sender to retransmit only specific lost
packets, which reduces unnecessary retransmissions and increases efficiency.
8. Connection-Oriented Transport - TCP (Transmission Control Protocol)
● TCP Characteristics:
○ Reliable, connection-oriented, and provides in-order data delivery.
○ Establishes a virtual connection between sender and receiver before data transfer
begins.
● TCP Segment Structure:
○ Source Port Number (16 bits): Identifies the port number of the application sending
the data on the source device.
○ Destination Port Number (16 bits): Identifies the port number of the application
receiving the data on the destination device.
○ Sequence Number (32 bits): Used to ensure data is received in the correct order. It
indicates the position of the first byte of data in this segment within the entire data
stream.
○ Acknowledgment Number (32 bits): If the ACK flag is set, this field contains the
next sequence number that the sender of the segment expects to receive.
○ Header Length (4 bits): Specifies the length of the TCP header in 32-bit words.
This is also known as the Data Offset field.
○ Reserved (6 bits): Reserved for future use and should be set to zero.
○ Flags (9 bits):
■ URG: Urgent pointer field is significant.
■ ACK: The acknowledgement field is significant.
■ PSH: Push function; data should be sent to the receiving application
immediately.
■ RST: Reset the connection.
■ SYN: Synchronize sequence numbers to initiate a connection.
■ FIN: No more data from the sender (finish the connection).
○ Window Size (16 bits): Specifies the size of the receive window, which is the buffer
space available for incoming data. It helps with flow control.
○ TCP Checksum (16 bits): Used for error-checking the header and data.
○ Urgent Pointer (16 bits): Points to the sequence number of the byte following
urgent data, if the URG flag is set.
○ Options (Variable length): Optional settings for TCP, such as maximum segment
size or window scaling.
○ Data (Variable length): Contains the actual data being transmitted. This is optional,
as a TCP segment could consist solely of control information.
9. Flow Control
● Purpose: Flow control is a mechanism to prevent a fast sender from overwhelming a slow
receiver.
● How it works: The receiver informs the sender about the amount of data it can handle
through the Receive Window (rwnd) field in the TCP header. This value tells the sender the
size of the receiver's buffer, allowing the sender to control the rate at which it sends data.
● Mechanism:
○ Every time the receiver sends an acknowledgment (ACK), it updates the rwnd to
show how much buffer space is left.
○ The sender respects this rwnd and only sends data that fits within the advertised
buffer space.
○ If the rwnd is zero, the sender pauses until the receiver signals that it has space
available again.
● Example: Imagine a sender that can send data very fast, but the receiver can only process
it slowly. Flow control ensures the sender only sends data at a rate the receiver can handle,
preventing data loss due to buffer overflow.
1. Buffer Overflow: When a receiver's buffer (storage space) is full, incoming data can be lost.
2. Internal Network Congestion: Even if the receiver has enough buffer space, the network's
internal carrying capacity may still be exceeded, causing congestion within the network.
● Setup: Two senders, two receivers, and one router with infinite buffer capacity (no
data loss).
● Result: Since there is no buffer limit, congestion issues related to data loss don’t
arise, but data may still face delays if the network is overloaded.
● Setup: One router with finite buffer space, which may fill up and cause packet loss.
● Key Points:
○ Original Data (λin): Data input directly from the application layer.
○ Transport Layer Input (λ'in): Includes original data plus any retransmitted
data due to timeouts or packet loss.
○ Outcome: When buffer space runs out, new packets cannot be stored, and
data loss occurs.
● Variations within Scenario 2:
○ Idealization with Known Buffer Space:
■ If the sender knows the exact available buffer space, it can avoid
sending too much data, which prevents buffer overflow.
■ Ideal Case: No congestion issues as the sender adjusts its rate
based on buffer availability.
○ Known Packet Loss:
■ When buffers are full, packets are dropped.
■ The sender only resends data if it knows which packets were lost.
■ This approach minimizes unnecessary retransmissions but still
suffers from data loss if congestion persists.
○ Realistic Condition with Duplicate Packets:
■ Packets may be dropped due to full buffers, causing the sender to
timeout and resend packets prematurely.
■ This results in duplicate packets, increasing congestion as both
copies are eventually delivered when buffer space becomes
available.
● TCP Slow Start is an algorithm designed to manage the speed of data transmission in a
network, helping to prevent congestion. It’s one of the initial steps in TCP's congestion
control process.
● The main goal of TCP Slow Start is to find a balance between:
○ Congestion Window (cwnd): The amount of data the sender is allowed to send.
○ Receiver Window (rwnd): The amount of data the receiver is capable of handling.