module 4 imp cn pdf
module 4 imp cn pdf
The Transport Layer in networking ensures smooth and reliable data communica on
between devices over a network. Here's a simplified explana on of its services:
1. Process-to-Process Communica on: The Transport Layer makes sure data gets
delivered to the correct applica on or process on a device, using port numbers.
2. Addressing: It uses unique port numbers combined with IP addresses to iden fy
communica on endpoints, dis nguishing different applica ons on the same device.
3. Encapsula on and Decapsula on:
o Encapsula on: At the sender's side, the Transport Layer wraps data with a
header containing informa on needed for transmission.
o Decapsula on: At the receiver's side, it removes the header to deliver the
data to the correct applica on.
4. Mul plexing and Demul plexing:
o Mul plexing: Combines data from mul ple applica ons into a single stream
for efficient transfer.
o Demul plexing: Splits the incoming stream to send data to the right
applica on.
5. Flow Control: Manages the rate of data transfer between sender and receiver to
avoid overwhelming the receiver.
6. Error Control: Detects and corrects issues like lost or corrupted data by
retransmi ng packets as needed.
These services work together to ensure data is delivered accurately, reliably, and in the
correct order. Transport-layer protocols like TCP (Transmission Control Protocol) provide a
connec on-oriented, reliable service, while UDP (User Datagram Protocol) offers a faster,
connec onless service without guarantees.
Process-to-Process Communica on at the Transport Layer ensures that the data sent from
one device reaches the exact applica on or program it is meant for on another device.
Here's a simple explana on:
1. Why is this needed?
o On a device, mul ple applica ons (e.g., a browser, email client, or chat app)
might be running simultaneously. The Transport Layer makes sure that data is
delivered to the correct applica on, not just the device as a whole.
3. Here’s a simple explana on of the FSM diagrams for connec onless and connec on-oriented
services in the transport layer:
3. Draw the FSM diagrams for connec onless and connected oriented
services offered by transport layer.
Key Differences:
Stop-and-Wait Protocol
The Stop-and-Wait Protocol is a simple data-link layer protocol that can also be
applied in the transport layer for reliable communica on. Here's how it works:
How It Works:
1. Sender Side:
o The sender transmits one data packet (or frame) at a me.
o A er sending the packet, the sender waits for an acknowledgment (ACK) from
the receiver before sending the next packet.
2. Receiver Side:
o When the receiver gets the packet, it sends an acknowledgment back to the
sender.
o If the packet is corrupted, the receiver discards it, and no acknowledgment is
sent.
3. Retransmission:
o If the sender does not receive an acknowledgment within a specified me
( meout), it retransmits the same packet.
Key Features:
Reliability:
o Ensures that each packet is delivered successfully before sending the next
one.
o Prevents loss of data in transmission.
Acknowledgment Mechanism:
o ACK ensures that the receiver has successfully received the packet.
Simple Flow Control:
o The sender stops and waits, preven ng overwhelming the receiver with data.
Advantages:
Simplicity: Easy to implement and understand.
Error Handling: Uses retransmission for lost or corrupted packets.
Disadvantages:
Inefficiency: Only one packet is sent at a me, which results in low u liza on of the
communica on channel, especially over long distances (high latency).
Idle Time: The sender remains idle while wai ng for the acknowledgment.
Use Cases:
Suitable for systems with low traffic and small delays.
Used in early communica on systems or for teaching basic networking concepts.
How It Works:
1. Sender's Sliding Window:
o The sender maintains a window of packets it can send without wai ng for an
ACK.
o This window size is denoted as N (the maximum number of unacknowledged
packets).
o The sender sends packets one a er another un l the window is full.
2. Receiver's Role:
o The receiver can only accept packets in sequence.
o If a packet is out of order, it is discarded.
o The receiver sends an ACK for the last correctly received packet.
3. Resending Packets:
o If a packet is lost or corrupted, the sender will resend all packets star ng
from the lost packet upon meout or receiving a nega ve acknowledgment
(NAK).
Key Components:
Send Window:
Tracks which packets are:
o Already acknowledged.
o Sent but not yet acknowledged.
o Ready to be sent.
o Not yet ready to be sent (outside the window).
Receive Window:
Always expects the next sequen al packet.
Slides forward only when the expected packet is received.
Advantages:
Increases efficiency by allowing mul ple packets to be sent simultaneously.
Uses fewer ACKs compared to Stop-and-Wait.
Disadvantages:
Resending all unacknowledged packets during an error can lead to inefficiency,
especially in high-latency networks.
Example:
Scenario: Sender wants to send packets 1 through 5. The window size (N) is 3.
Use Case:
Used in protocols like TCP for reliable data transmission, with minor modifica ons.
How It Works:
1. Sender’s Role:
o The sender transmits mul ple packets within a "sliding window" size.
o If a packet is lost or corrupted, only that specific packet is retransmi ed a er
a meout.
o The sender tracks which packets have been acknowledged and retransmits
only those that are not.
2. Receiver’s Role:
o The receiver has a buffer to store packets received out of order.
o It sends acknowledgments (ACKs) for each correctly received packet.
o Once the missing packet is received, the receiver reassembles the packets in
the correct order and delivers them to the applica on layer.
3. Acknowledgment Mechanism:
o The receiver sends ACKs for each packet it successfully receives, even if
packets arrive out of order.
o Nega ve acknowledgments (NAKs) may also be used to indicate specific lost
packets.
Key Components:
1. Sender Window:
o Defines the range of packets the sender is allowed to send without wai ng for
an acknowledgment.
o Tracks which packets are sent and acknowledged.
2. Receiver Window:
o Tracks the packets expected from the sender.
o Accepts out-of-order packets within the window and buffers them un l
missing packets are received.
Advantages:
Efficiency: Retransmits only lost or corrupted packets, reducing overhead.
Be er Bandwidth U liza on: Handles out-of-order packets effec vely, minimizing
delays caused by retransmission.
Disadvantages:
Complex Implementa on: Requires more resources to manage individual packet
tracking and buffering at the receiver side.
Increased Memory Usage: The receiver needs a buffer to store out-of-order packets.
Example:
Suppose a sender sends packets 1 to 5, and packet 3 is lost:
1. Receiver ACKs packets 1, 2, 4, and 5 but indicates packet 3 is missing.
2. The sender retransmits only packet 3.
3. The receiver places packet 3 in the correct posi on and delivers all packets in
order.
Comparison to Go-Back-N:
Out-of-Order
Discards out-of-order packets Buffers out-of-order packets
Handling
Use Case:
Suitable for networks with higher error rates, where retransmi ng only specific
packets is more efficient than retransmi ng all packets.
7.UDP SERVICES AND APPLICATION
Services of UDP:
1. Process-to-Process Communica on:
o UDP uses port numbers to allow communica on between specific
applica ons or processes on different devices.
2. Connec onless Service:
o No connec on setup is needed; each packet is sent independently.
3. Flow Control:
o UDP does not provide flow control, leaving it to the applica on to manage
data rates.
4. Error Control:
o Limited to a basic checksum to detect errors; it does not retransmit lost or
corrupted packets.
5. Checksum:
o Includes an op onal checksum for error detec on in the data and parts of the
IP header.
6. Conges on Control:
o UDP does not manage network conges on, making it suitable for applica ons
needing fast data transfer.
7. Encapsula on and Decapsula on:
o Wraps applica on messages into packets for transmission and unpacks them
upon receipt.
8. Queuing:
o Maintains separate input and output queues for different processes, helping
manage data flow.
9. Mul plexing and Demul plexing:
o Enables mul ple applica ons to share UDP services by direc ng messages to
the correct port.
Applica ons of UDP:
1. Connec onless Service:
o Ideal for short, fast communica on where reliability is less cri cal.
2. Real-Time Applica ons:
o Widely used in real- me audio, video streaming, and online gaming where
speed is essen al.
3. Simple Request-Response Communica on:
o Suitable for lightweight exchanges, like DNS lookups or me synchroniza on.
4. Mul cas ng Support:
o UDP is commonly used for mul cast applica ons, such as streaming media to
mul ple devices simultaneously.
5. Network Management:
o Protocols like SNMP (Simple Network Management Protocol) rely on UDP for
simplicity and efficiency.
6. Rou ng Protocols:
o UDP is used in rou ng updates, such as RIP (Rou ng Informa on Protocol).
7. Internal Error and Flow Control:
o Applica ons like TFTP (Trivial File Transfer Protocol) handle their own
reliability mechanisms while using UDP for faster communica on.
Services of TCP:
1. Process-to-Process Communica on:
o TCP uses port numbers to iden fy specific applica ons or processes, allowing
communica on between them.
2. Stream Delivery Service:
o Provides data as a con nuous stream of bytes, simula ng a direct link
between sender and receiver.
3. Reliable Data Transfer:
o Ensures data is delivered without errors, in the correct order, and without
duplica on.
4. Full-Duplex Communica on:
o Allows simultaneous sending and receiving of data between two devices.
5. Connec on-Oriented Service:
o Uses a three-way handshake to establish a connec on before data transfer
and ensures proper closure a er data transfer.
6. Error Detec on and Correc on:
o TCP detects errors using checksums and retransmits lost or corrupted
packets.
7. Flow Control:
o Balances the sender’s data rate with the receiver’s processing capability to
avoid overwhelming the receiver.
8. Conges on Control:
o Adjusts the sending rate based on network conges on to prevent packet loss.
9. Mul plexing and Demul plexing:
o Manages mul ple connec ons by associa ng each with a unique port
number.
o Supports protocols like FTP (File Transfer Protocol) for reliable file uploads
and downloads.
3. Email:
o Used by email protocols such as SMTP, IMAP, and POP3 for error-free
communica on.
4. Remote Access:
o Powers secure remote login protocols like SSH (Secure Shell).
5. Database Access:
o Ensures reliable communica on between applica ons and database servers.
6. Real-Time Chat:
o Used in chat applica ons that priori ze reliability, such as instant messaging.
TCP establishes a reliable connec on between a client and a server using a three-way
handshake. Here's how it works:
The client sends a SYN (synchronize) segment to the server to ini ate a
connec on.
The segment includes:
o A randomly chosen sequence number.
o The SYN flag set to indicate the start of the connec on.
Step 3: ACK
1. Sequence Numbers: These ensure data is sent and received in the correct order and
prevent duplicates.
2. Acknowledgment Numbers: Confirm that each party has received the other's
request.
3. SYN and ACK Flags: Used to manage the connec on setup process.
11.TCP CONGESTION CONTROL
Fast Retransmit: The sender quickly resends the lost segment without
wai ng for a meout.
Fast Recovery: cwnd is reduced to half (mul plica ve decrease), and
the sender resumes linear growth from there.
4. Timeout and Retransmission:
o If a meout occurs (indica ng severe conges on), TCP resets the conges on
window to 1 segment and re-enters Slow Start.
TCP Variants
Tahoe TCP: Resets to Slow Start a er loss.
Reno TCP: Uses Fast Retransmit and Recovery for efficiency.
NewReno TCP: Be er handles mul ple packet losses.
1. Slow Start: cwnd grows exponen ally during the ini al phase【5†source】.
3. Fast Recovery: cwnd reduc on upon mild conges on, avoiding a full reset【5†source
】.
TCP's conges on control ensures op mal network usage, avoids conges on collapse, and
maintains reliable communica on.
TCP Variants
Tahoe TCP: Resets to Slow Start a er loss.
Reno TCP: Uses Fast Retransmit and Recovery for efficiency.
NewReno TCP: Be er handles mul ple packet losses.
12. Explain FSM for Reno TCP
Key Features
Handles mild conges on more efficiently by avoiding a full reset.
Combines Fast Retransmit (resend lost packet) with Fast Recovery for smoother
performance.
2. Window Adjustment:
The receiver manages the flow control by upda ng its receive window size
(rwnd) based on the amount of data it can currently accept, helping the
sender control its data transmission rate.
3. Feedback Mechanism:
Flow control feedback travels from the receiving TCP to the sending TCP to
inform it of any changes in the receive window size, so the sender knows how
much data it can send.
4. Window Dynamics:
The receive window opens or closes depending on the data being received
and processed, while the send window adjusts according to the receive
window updates from the receiver.
Error control ensures data is delivered accurately and in order, handling packet loss,
duplica on, and corrup on.
Mechanism
1. Acknowledgments (ACKs):
o The receiver sends an acknowledgment (ACK) for successfully received data.
o A cumula ve ACK indicates all bytes up to a certain point have been received.
2. Checksum:
o Each TCP segment includes a checksum to detect errors in the data or header.
o If an error is detected, the receiver discards the segment and requests
retransmission.
3. Retransmissions:
o Timeout: If no ACK is received within a certain me, the sender retransmits
the unacknowledged data.
o Fast Retransmit: Triggered by three duplicate ACKs, indica ng packet loss
without wai ng for a meout.
4. Duplicate ACKs:
o These are used to indicate missing packets to the sender, allowing quick
recovery.
5. Retransmission Timer:
o A mer is set for each segment sent. If the mer expires before receiving an
ACK, the segment is retransmi ed.