Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

Module 3

(Part – 3)
(Transport Layer: Process to Process Communication, User Datagram Protocol
(UDP), Transmission Control Protocol (TCP), Congestion Control.)

Dr. Nirnay Ghosh


Assistant Professor
Department of Computer Science & Technology
IIEST, Shibpur
3/20/2021 Computer Networks (Module 3) 1
Connectionless Transport: UDP
• Network management application (SNMP) –
uses UDP
• Such applications run when the network is
in a stressed state
• Reliable, congestion-controlled data transfer
is difficult to achieve
• Multimedia data – used both TCP and
UDP
• E.g.: Internet phone, real-time video UDP Segment Structure
conferencing, streaming of stored audio and • UDP Segment Structure: Header - 4 fields (2 bytes
video each)
• Can tolerate a small amount of packet loss • Source and Destination Port Numbers: allows the
destination host to pass the application data to correct
• Reliability of data is not absolutely critical process running on the destination system
(demultiplexing)
• Drawbacks: running multimedia applications • Length: Number of bytes in the UDP segment (header +
over UDP data)
• UDP lacks congestion control: high loss rates • Checksum: used by the receiving host to check whether
between UDP sender and receiver errors have been introduced into the segment
• Other TCP-based applications may reduce • Message: data from the application (e.g., query/response
sending rates in the face of congestion message from DNS, audio samples for streaming audio
3/20/2021 applications, etc.) 2
Computer Networks (Module 3)
UDP Checksum
• Determines if the bits in the UDP segment
have been altered as it moved from source
to destination
• Bits may be altered due to noise in the links
or while stored in the router memory
• Sender side UDP: performs 1’s complement
sum of all 16-bit words in the segment
• Overflow encountered during sum is UDP Segment Structure
wrapped around • UDP error detection: essential as neither
• The result is put into the checksum field of link-by-link reliability nor router in-memory
the UDP segment detection is guaranteed
• Receiver side UDP: all 16-bit words • Provides error detection but no recovery
(including the checksum) are added • Damaged segment is discarded or passed to
• No error: sum will be all 1’s the application with a warning
• Otherwise, at least one bit is changed
3/20/2021 3
Computer Networks (Module 3)
Reliable Data Transfer Mechanisms

3/20/2021 4
Computer Networks (Module 3)
Connection-oriented Transport: TCP
• TCP: Internet’s transport-layer protocol,
reliable, connection-oriented
• Intermediate network elements (routers and
link-layer switches) do not maintain TCP
connection state
• TCP connection: point-to-point, full-duplex
• Between a single sender and a single receiver
• Processes running at two end systems can TCP Send and Receive Buffers
communicate simultaneously
• Consists of two sets of buffers, variables, and • Client process: passes a stream of data
sockets to connect two processes running on through the socket to the TCP running in the
two end stations
client
• Connection-oriented: three-way handshake • TCP directs this data to the connection’s send
protocol between client and server buffer
• Client send a special TCP segment (no application-
layer data) • TCP will grab a chunk of data from the send
• Server responds with a second special TCP buffer and pass it on the network layer
segment (no application-layer data) • Maximum segment size (MSS): maximum amount
• Client responds again with a third special segment of data that be placed in a TCP segment
(may carry payload)
• Once the TCP connection is established the two
• Server process: receives a segment and places
applications can send data its data in the TCP connection’s receive buffer
3/20/2021 5
Computer Networks (Module 3)
TCP: MSS & Segment Structure
• Maximum Segment Size (MSS)
• Typically set by determining the length of the
largest link-layer frame (called maximum
transmission unit (MTU)
• Ensures that a TCP segment (encapsulated in an IP
datagram) containing data and header (typically 40
bytes) fit into a single link-layer frame
• Both Ethernet and PPP link-layer protocols have an
MSS of 1500 bytes
• It is the maximum amount of the application data
TCP Segment Structure
• TCP Segment Structure • Header length (4-bit): length of the TCP header as multiples of 32-bit word
• Source and Destination port numbers (16-bit each): • Flags (6-bit):
used for multiplexing/demultiplexing data from/to
• ACK bit: indicates the value carried in the acknowledgement field is valid
upper-layer applications
• RST, SYN, FIN bits: used for connection setup and teardown
• Sequence number (32-bit) & Acknowledgement
• PSH bit: indicates that the receiver should pass the data to the upper layer
number (32-bit): used by the TCP sender and immediately
receiver in implementing a reliable data transfer • URG bit: data in this segment is marked ‘Urgent’ by the sending side upper
service layer
• Receive window (16-bit): used for flow control – • Urgent data pointer (16-bit): indicates the location of the last byte of this
used to indicate the number of bytes that a receiver urgent data to the receiving side upper layer
is willing to accept • Options (32-bit): optional and variable-length field – used when a sender and
receiver negotiate the MSS or a window scaling factor used for high-speed
3/20/2021 networks 6
Computer Networks (Module 3)
TCP: Sequence Numbers & Acknowledgement Numbers
• Critical part of TCP’s reliable data transfer
service
• TCP views data as an unstructured, but
ordered stream of bytes
• Sequence number: Dividing Data File into TCP Segments
• Inserted in the sequence number field in
the header of the TCP segment • Acknowledgement number:
• Assigned over the stream of transmitted • Inserted into the TCP segment by a
bytes and not over the series of receiving host
transmitted segments • It is the sequence number of the next byte
• Byte-stream number of the first byte in it is expecting from the sending host
the segment • Example: Acknowledgement number in the
• Example: MSS is 1000 bytes and TCP segment sent by the receiver after
sequence numbers of first and second receiving data for the second segment is
segments are 0 and 1000, respectively 2000
3/20/2021 7
Computer Networks (Module 3)
TCP: Round Trip Time Estimation & Timeout
• TCP uses a timeout/retransmit mechanism to
recover from lost segments
• Implementation challenge: how much larger the
timeout should be than the connection’s round
trip-time (RTT)?
• Estimating RTT
• SampleRTT: amount of time elapsed between when
the segment is sent and the corresponding
acknowledgement is received
• It is measured for the segments which have been
transmitted once RTT Samples and RTT Estimates
• It fluctuates from segment to segment due to
congestion in the routers and varying loads on the • EstimatedRTT: smoothens the variations in the
end systems SampleRTT
• Estimation: take weighted combination of the • DevRTT: Variability of the RTT
previous value of EstimatedRTT and the new value
of SampleRTT • Estimates of how much SampleRTT typically deviates
from the EstimatedRTT
• Exponential Weighted Moving Average (EWMA):
weight of a given SampleRTT decays exponentially • EWMA of the difference between SampleRTT and
fast as the updates proceeds EstimatedRTT

3/20/2021 • Recommended value for β = 0.125 8


• Recommended value for α = 0.125 Computer Networks (Module 3)
TCP: Setting and Managing the Retransmission Timeout Interval
• TCP’s timeout interval: should be greater
than or equal to EstimatedRTT
• Otherwise: unnecessary retransmission
would be sent
• Timeout interval: should not be too large
than EstimatedRTT
• TCP would not quickly retransmit the
segment leading to larger data transfer delays
• Desirable to set the time equal to the RTT Samples and RTT Estimates

EstimatedRTT plus some margin • Initial TimeoutInterval: 1 second (recommended)


• Margin: • Subsequently the value is doubled to avoid premature
• Large: if there is a lot of fluctuation in the timeout occurring for a segment that will soon be
SampleRTT values acknowledged
• Small: if there is little fluctuation
• As soon the segment is received, EstimatedRTT is
• TCP’s method for determining the updated
retransmission timeout interval
• TimeoutInterval is computed using the above formula

3/20/2021 9
Computer Networks (Module 3)
TCP: Reliable Data Transfer
• Three major events related to data
transmission and retransmission in
the TCP sender are:
• Data received from the upper-layer
application
• Timer timeout
• ACK receipt
• Commonly occurring scanarios Scenario - 2
related to retransmission Scenario - 1
• 1. Retransmission due to lost
acknowledgment
• 2. Acknowledgement arrives after the
timeout
• 3. Cumulative acknowledgement
avoiding retransmission

Scenario - 3
3/20/2021 10
Computer Networks (Module 3)

You might also like