0% found this document useful (0 votes)
21 views

module 4 imp cn pdf

computer network important questions

Uploaded by

jnvarshitha1709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

module 4 imp cn pdf

computer network important questions

Uploaded by

jnvarshitha1709
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

1.

Transport layer services:

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.

2. Explain Transport-Layer Services Process-to-Process Communica on in detail

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.

2. How does it work?


o The Transport Layer uses port numbers to iden fy different applica ons.
o Each applica on is assigned a unique port number.
o For example:
 A web browser might use port 80 (HTTP) or 443 (HTTPS).
 An email applica on might use port 25 (SMTP) for sending emails.
3. Steps in Process-to-Process Communica on:
o Sender's Side:
 The applica on sends data to the Transport Layer.
 The Transport Layer adds the source port number (the applica on's
iden fier) and the des na on port number (the applica on the data is
intended for).
o Receiver's Side:
 The Transport Layer looks at the des na on port number to
determine which applica on should receive the data.
4. Example in Ac on:
o Imagine you're using a web browser and sending a chat message
simultaneously:
 The browser uses port 443 to send your web request.
 The chat app uses port 5222 (a common port for messaging).
 The Transport Layer keeps these communica ons separate and
ensures that web responses go to the browser and chat messages go
to the chat app.
5. Tools Involved:
o IP Address: Locates the correct device.
o Port Number: Locates the correct applica on within that device.
This service ensures that no ma er how many processes are running, the data is always sent
to and received by the right one.

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.

Connec onless Service (Figure 4.10)


 In a connec onless service, there’s no need to establish or terminate a connec on.
 The system has a single state:
o Ready State: Always ready to send or receive data at any me.
 Each data packet is treated independently, and no guarantee is provided for the
order or reliability of data delivery.
 Example: UDP (User Datagram Protocol) works this way.

2. Connec on-Oriented Service (Figure 4.11)


 In a connec on-oriented service, the system goes through mul ple states:
1. Connec on Establishment: A connec on is set up between sender and
receiver (e.g., using a handshake process).
2. Data Transfer: Data is reliably exchanged between the two connected par es.
3. Connec on Termina on: The connec on is properly closed a er data
exchange.
 Example: TCP (Transmission Control Protocol) follows this approach.


Key Differences:

 Connec onless: Simple, no setup/teardown, less reliable.


 Connec on-Oriented: Involves setup and teardown, more reliable and orderly.

What is an FSM (Finite State Machine)?


An FSM (Finite State Machine) is a simple model used to represent how a system transi ons
between different states based on events or ac ons. It’s commonly used in networking to
explain how protocols or services behave.

FSM for Connec onless Service


In a connec onless service, the FSM is very straigh orward:
1. Single State: "Ready"
o The system is always ready to send or receive data.
o There is no need to establish or close a connec on.
o When data arrives, it is processed immediately, without wai ng or confirming
order/reliability.
Example: UDP operates this way.

FSM for Connec on-Oriented Service


A connec on-oriented service involves mul ple states. Here's how the FSM works:
1. Connec on Establishment:
o The system starts in an Idle State.
o The connec on is ini ated by the sender (e.g., sending a SYN in TCP).
o Once both sender and receiver agree, the connec on moves to the next
state.
2. Data Transfer:
o The connec on enters the Established State.
o Data is sent and received between the sender and receiver.
o Flow control, error checking, and acknowledgments ensure data reliability
and order.
3. Connec on Termina on:
o When the data transfer is complete, either side can ini ate connec on
termina on (e.g., sending a FIN in TCP).
o The connec on transi ons to the Terminated State, comple ng the process.

Why FSMs Ma er in Transport Layer


FSMs help us understand:
 Connec onless Service: Simple and always ready to handle data without
setup/teardown.
 Connec on-Oriented Service: More complex, as it ensures reliability with setup, data
transfer, and teardown processes.
4. TRANSPORT-LAYER PROTOCOLS

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.

5.Go-back-N Protocol (GBN)

Go-Back-N (GBN) Protocol


The Go-Back-N Protocol is a reliable data transmission method that allows the sender to
send mul ple packets before wai ng for an acknowledgment (ACK). It improves efficiency
compared to the Stop-and-Wait protocol by using a "sliding window" mechanism.

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.

1. Sender sends packets 1, 2, and 3.


2. Receiver ACKs packet 1.
3. Sender slides the window and sends packet 4.
4. If packet 2 is lost, the sender resends packets 2, 3, and 4 a er a meout.

Use Case:
 Used in protocols like TCP for reliable data transmission, with minor modifica ons.

6. Selec ve-Repeat Protocol

Selec ve-Repeat Protocol


The Selec ve-Repeat Protocol is a reliable data transmission method that improves
efficiency by retransmi ng only specific lost or corrupted packets instead of all
unacknowledged packets, as in the Go-Back-N protocol.

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:

Feature Go-Back-N Selec ve-Repeat

Retransmits all unacknowledged Retransmits only lost


Retransmission
packets packets

Out-of-Order
Discards out-of-order packets Buffers out-of-order packets
Handling

Efficiency Less efficient More efficient

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 and Applica ons of UDP (as per the PDF)

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.

8.TCP SERVICES AND APPLICATION

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.

Applica ons of TCP:


1. Web Browsing:
o Used for HTTP/HTTPS protocols to deliver reliable web page data.
2. File Transfer:

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.

7. Applica ons Requiring Reliable Communica on:


o Any applica on that needs guaranteed data delivery and order, such as e-
commerce transac ons.

8. Explain connec on establishment of TCP using 3-way handshaking.

TCP Connec on Establishment: 3-Way Handshaking (Simple and Detailed)

TCP establishes a reliable connec on between a client and a server using a three-way
handshake. Here's how it works:

Step 1: SYN (Synchronize)

 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 2: SYN + ACK (Acknowledge)

 The server responds with a SYN + ACK segment:


o It acknowledges the client's request by se ng the ACK flag and sending
an acknowledgment number (client's sequence number + 1).
o It also sends its own randomly chosen sequence number and sets the SYN
flag.

Step 3: ACK

 The client sends an ACK segment:


o The ACK confirms the receipt of the server's SYN + ACK segment by
sending the acknowledgment number (server's sequence number + 1).
o A er this step, the connec on is established, and data transmission can
begin.
o

Key Features of the Handshake:

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

TCP Conges on Control: Simple and Detailed Explana on


TCP conges on control ensures efficient data transfer by avoiding network conges on and
responding appropriately when conges on occurs. It uses mechanisms to adjust the data
flow based on network condi ons.

Key Concepts in TCP Conges on Control


1. Conges on Window (cwnd):
o A limit set by the sender on the amount of data that can be sent without
receiving an acknowledgment.
o The size of this window changes dynamically based on network feedback.
2. Slow Start Threshold (ssthresh):
o A point used to switch between the Slow Start and Conges on Avoidance
phases.
3. Feedback Mechanisms:
o Conges on is detected using:
 Packet loss (indicated by meouts).
 Duplicate acknowledgments (indica ng out-of-order packets).

Phases of Conges on Control


1. Slow Start:
o At the start of a connec on or a er detec ng conges on, TCP begins
cau ously.
o The conges on window (cwnd) increases exponen ally (doubling each
round-trip me) to quickly find the network's capacity.
o This con nues un l cwnd reaches the slow start threshold (ssthresh) or
packet loss occurs.
2. Conges on Avoidance:
o A er reaching the slow start threshold, the window grows linearly (adding
one segment per round-trip me).
o This prevents overwhelming the network as it approaches its capacity.
3. Fast Retransmit and Fast Recovery:
o If the sender detects packet loss through duplicate ACKs:

 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.

Illustra ons from PDF

1. Slow Start: cwnd grows exponen ally during the ini al phase【5†source】.

2. Conges on Avoidance: Linear growth a er reaching ssthresh【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.

Simplified explana on:

TCP Conges on Control (Simplified)


TCP conges on control ensures smooth data flow by adap ng to network capacity and
preven ng conges on. It uses key mechanisms like the conges on window (cwnd) and
adjusts data transmission based on feedback from the network.

Phases of TCP Conges on Control


1. Slow Start:
o At the beginning, TCP cau ously increases cwnd exponen ally (doubles every
round-trip me) to quickly discover network capacity.
o Stops when it hits a threshold (ssthresh) or detects packet loss.
2. Conges on Avoidance:
o A er reaching the threshold, cwnd grows linearly (1 segment per round-trip)
to prevent overwhelming the network.
3. Fast Retransmit and Fast Recovery:
o If packet loss is detected by duplicate acknowledgments:
 Fast Retransmit: Retransmits lost data without wai ng for a meout.
 Fast Recovery: Reduces cwnd to half and resumes linear growth.
4. Timeout:
o Severe conges on causes a meout, rese ng cwnd to 1 and re-entering 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.
12. Explain FSM for Reno TCP

FSM for Reno TCP (Simplified Explana on)


The Finite State Machine (FSM) for Reno TCP illustrates how it manages conges on control
by transi oning between states based on network feedback. Here's a simplified explana on:

States in Reno TCP FSM


1. Slow Start:
o Ini al state where the conges on window (cwnd) grows exponen ally
(doubles every round-trip me).
o Transi on: Moves to Conges on Avoidance when cwnd reaches the slow-start
threshold (ssthresh).
2. Conges on Avoidance:
o cwnd grows linearly (increases by 1 segment per round-trip me) to avoid
conges on.
o Transi on: If packet loss is detected ( meout or duplicate ACKs), it moves to
Fast Recovery.
3. Fast Recovery:
o Triggered by 3 duplicate ACKs, indica ng mild conges on.
o cwnd is reduced to half (mul plica ve decrease) but avoids a full reset.
o Transi on:
 If new ACKs confirm data receipt, it resumes Conges on Avoidance.
 If a meout occurs, it resets to Slow Start.

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.

12. FLOW CONTROL AND ERROR CONTROL IN TCP

Here are five main points about flow control in TCP:


1. TCP Flow Control Purpose:
Flow control in TCP prevents the sender from overwhelming the receiver by
adjus ng the send and receive windows based on the receiver's buffer
capacity.

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.

5. Silly Window Syndrome Solu ons:


TCP uses algorithms like Nagle's and Clark's solu ons to prevent inefficient
small data transfers (silly window syndrome) by wai ng for sufficient data
before sending segments.

TCP Error Control

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.

You might also like