0% found this document useful (0 votes)
41 views47 pages

OSI Transport Layer: Network Fundamentals - Chapter 4 Modified by Dickson Lungu

The document discusses the transport layer of the OSI model and its functions, including enabling multiple applications to communicate concurrently, ensuring reliable data delivery, and employing port addressing to direct data to the proper application. It describes how transport layer protocols segment data for transmission and reassemble it, and how protocols like TCP provide additional functions like reliable data delivery and flow control.

Uploaded by

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

OSI Transport Layer: Network Fundamentals - Chapter 4 Modified by Dickson Lungu

The document discusses the transport layer of the OSI model and its functions, including enabling multiple applications to communicate concurrently, ensuring reliable data delivery, and employing port addressing to direct data to the proper application. It describes how transport layer protocols segment data for transmission and reassemble it, and how protocols like TCP provide additional functions like reliable data delivery and flow control.

Uploaded by

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

OSI Transport Layer

Network Fundamentals – Chapter 4


Modified by Dickson Lungu

01/27/2010

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 1


Objectives
 In this chapter, we examine the role of the Transport
layer. The Transport layer also encompasses these
functions:
– Enables multiple applications to communicate over the
network at the same time on a single device
– Ensures that, if required, all the data is received reliably
and in order by the correct application
– Employs error handling mechanisms
 Learning Objectives
– Upon completion of this chapter, you will be able to:
– Explain the need for the Transport layer.
– Identify the role of the Transport layer as it provides the
end-to-end transfer of data between applications.
– Describe the role of two TCP/IP Transport layer
protocols: TCP and UDP.
– Explain the key functions of the Transport layer,
including reliability, port addressing, and segmentation.
– Explain how TCP and UDP each handle key functions.
– Identify when it is appropriate to use TCP or UDP and
provide examples of applications that use each protocol.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 2


Purpose of the Transport Layer
 The Transport layer provides for the segmentation of data necessary to
reassemble these pieces into the various communication streams.
 Its primary responsibilities to accomplish this are:
–Tracking the individual communication between applications
on the source and destination hosts
•Any host may have multiple applications that are communicating
across the network.
•It is the responsibility of the Transport layer to maintain the
multiple communication streams between these applications.
–Segmenting data and managing each piece
•The Transport layer protocols describe services that segment
this data from the Application layer.
•Each piece of application data requires headers at the Transport
layer to indicate to which communication it is associated.
–Reassembling the segments into application data
•At the receiving host, these individual pieces of data must also
be reconstructed into a complete data stream that is useful to the
Application layer.
–Identifying the different applications
•In order to pass data streams to the proper applications, the
Transport layer must identify the target application.
•To accomplish this, the Transport layer assigns an application an
identifier. The TCP/IP protocols call this identifier a port number.
•Each software process that needs to access the network is
assigned a port number unique in that host.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 3


Purpose of the Transport Layer: link between the layers
 The Transport layer is the link between the
Application layer and the lower layer that are
responsible for network transmission.
–This layer accepts data from different conversations
and passes it down to the lower layers as manageable
pieces that can be eventually multiplexed over the
media.
 Applications do not need to know the operational
details of the network in use.
–The applications generate data that is sent from one
application to another, without regard to the destination host
type, the type of media over which the data must travel, the
path taken by the data, the congestion on a link, or the size
of the network.
 Additionally, the lower layers are not aware that there are
multiple applications sending data on the network.
–Their responsibility is to deliver data to the appropriate
device. The Transport layer then sorts these pieces before
delivering them to the appropriate application.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 4


Transport Layer: multiple Transport layer protocols
 Because different applications have different requirements,
there are multiple Transport layer protocols.
–For some applications, segments must arrive in a very specific
sequence in order to be processed successfully.
–In some cases, all of the data must be received for any of it to
be of use.
–In other cases, an application can tolerate some loss of data
during transmission over the network.
 The different Transport layer protocols have different rules
to handle these diverse data requirements.
–Some protocols provide just the basic functions for efficiently
delivering the data pieces between the appropriate applications.
•These types of protocols are useful for applications whose data is
sensitive to delays.
–Other Transport layer protocols describe processes that
provide additional features, such as ensuring reliable delivery
between the applications.
•While these additional functions provide robust communication at
the Transport layer, they have additional overhead and make
larger demands on the network.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 5


Transport Layer: Separating Multiple Communications
 Consider a computer that is simultaneously receiving and
sending e-mail and instant messages, viewing websites, and
conducting a VoIP phone call.
–Each of these applications is sending and receiving data over the
network at the same time.
–However, data from the phone call is not directed to the web
browser, and text from an instant message does not appear in an e-
mail.
 Users require that an e-mail or web page be completely
received for the information to be considered useful.
–Slight delays are considered acceptable to ensure that the
complete information is received and presented.
 In contrast, occasionally missing small parts of a telephone
conversation might be considered acceptable.
–This is considered preferable to the delays that would result from
asking the network to manage and resend missing segments.
–One can either infer the missing audio from the context of the
conversation or ask the other person to repeat what they said.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 6


Transport Layer: Dividing data into small parts
 As explained in a previous chapter, sending
some types of data - a video for example -
across a network as one complete
communication stream could prevent other
communications from occurring at the same
time. It also makes error recovery and
retransmission of damaged data difficult.
–Segmentation of the data, in accordance with
Transport layer protocols, provides the means to
both send and receive data when running multiple
applications concurrently on a computer.
 At the Transport layer, each particular set of
pieces flowing between a source application and
a destination application is known as a
conversation.
–To identify each segment of data, the Transport
layer adds to the piece a header containing binary
data.
–It is the values in these fields that enable different
Transport layer protocols to perform different
functions.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 7


Transport Layer: Controlling the Conversations
 The primary functions specified by all Transport layer
protocols include:
–Segmentation and Reassembly
•The Transport layer divides application data into blocks of data
that are an appropriate size.
•At the destination, the Transport layer reassembles the data
before sending it to the destination application or service.
–Conversation Multiplexing
•There may be many applications or services running on each
host in the network.
•Each of these applications is assigned an address known as a
port so that the Transport layer can determine with which
application or service the data is identified.

 In addition to the basic functions of data segmentation


and reassembly, some protocols at the Transport layer
provide:
–Connection-oriented conversations
–Reliable delivery
–Ordered data reconstruction
–Flow control

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 8


Controlling the Conversations
 Establishing a Session
–The Transport layer can provide this connection orientation by creating
a sessions between the applications.
–These connections prepare the applications to communicate with each
other before any data is transmitted.
 Reliable Delivery
–For many reasons, it is possible for a piece of data to become
corrupted, or lost completely, as it is transmitted over the network.
–The Transport layer ensure that all pieces reach their destination by
having the source device to retransmit any data that is lost.
 Same Order Delivery
–Because networks may provide multiple routes that can have different
transmission times, data can arrive in the wrong order.
–By numbering the segments, the Transport layer can ensure that these
segments are reassembled into the proper order.
 Flow Control
–Network hosts have limited resources, such as bandwidth.
–When Transport layer is aware the resources are overtaxed, it can
request the sending application reduce the rate of data flow.
–Flow control can prevent the loss of segments on the network and
avoid the need for retransmission.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 9


Supporting Reliable Communication
 However, different applications have different
requirements for their data, and therefore different
Transport protocols have been developed to meet these
requirements.
 A Transport layer protocol can implement a method to
ensure reliable delivery of the data. At the Transport
layer the three basic operations of reliability are:
–tracking transmitted data
–acknowledging received data
–retransmitting any unacknowledged data
 These reliability processes place additional overhead on
the network resources due to the acknowledgement,
tracking, and retransmission.
 To support these reliability operations, more data is
exchanged between the sending and receiving hosts.
–The Transport layer of the receiving host must also track
the data as it is received and acknowledge the receipt of
the data.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 10


Determining the Need for Reliability
 At the Transport layer, there are protocols that specify
methods for either reliable, guaranteed delivery or best-effort
delivery.
–In the context of networking, best-effort delivery is referred to as
unreliable, because there is no acknowledgement that the data is
received at the destination.
 Applications, such as databases, web pages, and e-mail,
require that all of the sent data arrive at the destination in its
original condition, in order for the data to be useful.
–Therefore, these applications are designed to use a Transport
layer protocol that implements reliability. The additional network
overhead is considered to be required for these applications.
 Other applications are more tolerant of the loss of small
amounts of data. For example, if one or two segments of a
video stream fail to arrive, it would only create a momentary
disruption in the stream.
–Imposing overhead to ensure reliability for this application could
reduce the usefulness of the application.
–The image in a streaming video would be greatly degraded if the
destination device had to account for lost data and delay the
stream while waiting for its arrival.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 11


TCP and UDP
 The 2 most common Transport layer protocols:
–User Datagram Protocol (UDP)
•UDP is a connectionless protocol, described in RFC 768.
•It providing for low overhead data delivery.
•The pieces of communication in UDP are called datagrams.
•each UDP segment only has 8 bytes of overhead.
•These datagrams are sent as "best effort".
•Applications that use UDP include:
–Domain Name System (DNS)
–Video Streaming
–Voice over IP (VoIP)
–Transmission Control Protocol (TCP)
•TCP is a connection-oriented protocol, described in RFC 793.
•TCP incurs additional overhead to gain functions.
•Additional functions specified by TCP are the same order
delivery, reliable delivery, and flow control.
•Each TCP segment has 20 bytes of overhead in the header
encapsulating the Application layer data,
•Applications that use TCP are:
–Web Browsers
–E-mail
–File Transfers http://www.uic.rsu.ru/doc/inet/tc
p_stevens/tcp_tran.htm

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 12


Port Addressing: Identifying the Conversations
 The TCP and UDP based services keep track of the
various applications that are communicating. Both TCP
and UDP have header fields that can uniquely identify
these applications.
–These unique identifiers are the port numbers.
 In the header of each segment or datagram, there is a
source and destination port.
–The source port number is the number for this
communication associated with the originating application
on the local host.
–The destination port number is the number for this
communication associated with the destination
application on the remote host.
 Port numbers are assigned in various ways, depending
on whether the message is a request or a response.
–While server processes have static port numbers
assigned to them, clients dynamically choose a port
number for each conversation.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 13


Port Addressing: Identifying the Conversations
 When a client application sends a request to a server
application, the destination port contained in the header
is the port number that is assigned to the service
daemon running on the remote host.
–The client software must know what port number is
associated with the server process on the remote host.
–For example, when a web browser application makes a
request to a web server, the browser uses TCP and port
number 80 unless otherwise specified.
 The source port in a segment or datagram header of a
client request is randomly generated.
–As long as it does not conflict with other ports in use on
the system, the client can choose any port number (higher
than 1024).
–This port number acts like a return address for the
requesting application.
–The Transport layer keeps track of this port and the
application that initiated the request so that when a
response is returned, it can be forwarded to the correct
application.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 14


Port Addressing: a socket
 Socket:
–The combination of the Transport layer port number and
the Network layer IP address assigned to the host
uniquely identifies a particular process running on a
specific host device.
–Occasionally, you may find the terms port number and
socket used interchangeably.
–In the context of this course, the term socket refers only
to the unique combination of IP address and port number.
 A socket pair, consisting of the source and destination
IP addresses and port numbers, is also unique and
identifies the conversation between the two hosts.
–For example, an HTTP web page request being sent to
a web server (port 80) running on a host with a Layer 3
IPv4 address of 192.168.1.20 would be destined to socket
192.168.1.20:80.
–If the web browser requesting the web page is running
on host 192.168.100.48 and the Dynamic port number
assigned to the web browser is 49152, the socket for the
web page would be 192.168.100.48:49152.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 15


The IANA assigns port numbers
 Well Known Ports (Numbers 0 to 1023) - These numbers are
reserved for services and applications.
–HTTP (web server) POP3/SMTP (e-mail server) and Telnet.
 Registered Ports (Numbers 1024 to 49151) - These port
numbers are assigned to user processes or applications.
–These processes are primarily individual applications that a user
has chosen to install.
–When not used for a server resource, these ports may also be
used dynamically selected by a client as its source port.
 Dynamic or Private Ports (Numbers 49152 to 65535) - Also
known as Ephemeral Ports, these are usually assigned
dynamically to client applications when initiating a connection.
–It is not very common for a client to connect to a service using a
Dynamic or Private Port.
 Using both TCP and UDP
–Some applications may use both TCP and UDP.
•For example, the low overhead of UDP enables DNS to serve many
client requests very quickly.
•Sometimes, however, sending the requested information may require
the reliability of TCP.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 16


Port Addressing: netstat command
 Sometimes it is necessary to know
which active TCP connections are
open and running on a networked
host.
 Netstat is an important network utility
that can be used to verify those
connections. Netstat lists:
–the protocol in use,
–the local address and port number,
–the foreign address and port number,
–the state of the connection.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 17


Port Addressing: netstat command

 State:
–TIMED_WAIT Client enters this state after active close.
–ESTABLISHED Client received server's SYN and session is
established.
–More: http://support.microsoft.com/kb/137984

 Port:
–443: http protocol over TLS/SSL

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 18


Segmentation and Reassembly – Divide and Conquer
 A previous chapter explained how PDUs are built by
passing data from an application down through the
various protocols to create a PDU that is then
transmitted on the medium.
 Some applications transmit large amounts of data - in
some cases, many gigabytes.
–It would be impractical to send all of this data in one
large piece.
–Dividing application data into pieces both ensures that
data is transmitted within the limits of the media and that
data from different applications can be multiplexed on to
the media.
–At the destination host, this process is reversed until the
data can be passed up to the application.
 TCP and UDP Handle Segmentation Differently.
–In TCP, each segment header contains a sequence
number. This sequence number allows the Transport
layer functions on the destination host to reassemble
segments in the order in which they were transmitted.
–In UDP header, there is no sequence number. UDP is a
simpler design and generates less overhead than TCP,
resulting in a faster transfer of data.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 19


TCP-Making Conversations Reliable
 The key distinction between TCP and UDP is reliability.
 The reliability of TCP communication is performed using
connection-oriented sessions. (3 way handshake)
–Before a host using TCP sends data to another host, the
Transport layer initiates a process to create a connection with the
destination.
–This process ensures that each host is aware of and prepared
for the communication.
 After a session has been established (3 way handshake),
the destination sends acknowledgements to the source for
the segments that it receives.
–As the source receives an acknowledgement, it knows that the
data has been successfully delivered and can quit tracking that
data.
 If the source does not receive an acknowledgement within a
predetermined amount of time, it retransmits that data to the
destination.
–There is also additional overhead on the individual hosts created
by the necessity to keep track of which segments are awaiting
acknowledgement and by the retransmission process.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 20


TCP Server Processes
 It is common for a server to provide more than one
service, such as a web server and an FTP server, at
the same time.
 Each application process running on the server is
configured to use a port number, either by default or
manually by a system administrator.
–An individual server cannot have two services assigned to
the same port number within the same Transport layer
services.
•A host running a web server application and a file transfer
application cannot have both configured to use the same port.
–When an active server application is assigned to a specific
port, that port is considered to be "open" on the server.
•Any incoming client request addressed to the correct socket is
accepted and the data is passed to the server application.
–One way to improve security on a server is to restrict
server access to only those ports associated with the
services and applications that should be accessible to
authorized requestors.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 21


Extra information: Proxy Server
•In computer networks, a proxy server is a server (a computer system or
an application program) which services the requests of its clients by
forwarding requests to other servers.
•A listener is a port on the Internet Security and Acceleration (ISA) server
that is listening for TCP (transmission control protocol) connections.
•ISA server is configured by default to listen on port 8080

•Using proxy setting with browser.

http://www.aaa.com:8080/web1
http://www.bbb.com:8080/web2
http://www.ccc.com:8080/web3

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 22


Extra information: Proxy client with port 8080
•hard coded proxy setting within their Internet explorer browser.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 23


TCP Connection Establishment and Termination
 When two hosts communicate using TCP:
–a connection is established before data can be
exchanged.
–The host tracks each data segment within a session and
exchanges information about what data is received.
–After the communication is completed, the sessions are
closed and the connection is terminated.
 To establish the connection, the hosts perform a
three-way handshake.
–Establishes that the destination device is present on the
network
–Verifies that the destination device has an active service
and is accepting requests on the destination port number
that the initiating client intends to use for the session
–Informs the destination device that the source client
intends to establish a communication session on that port
number

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 24


TCP Connection Establishment: Three-way Handshake
 The three steps in TCP connection establishment
are:
–1. The initiating client sends a segment containing
an initial sequence value, which serves as a request
to the server to begin a communications session.
–2. The server responds with a segment containing
an acknowledgement value equal to the received
sequence value plus 1, plus its own synchronizing
sequence value.
•The value is one greater than the sequence number
because the ACK is always the next expected Byte or
Octet.
•This acknowledgement value enables the client to tie
the response back to the original segment that it sent to
the server.
–3. Initiating client responds with an
acknowledgement value equal to the sequence value
it received plus one. This completes the process of
establishing the connection.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 25


TCP Termination
 To understand the Termination process, it is important to look
at the various values that the two hosts exchange.
 Within the TCP segment header, there are six 1-bit fields that
contain control information used to manage the TCP
processes. Those fields are:
–URG - Urgent pointer field significant
–ACK - Acknowledgement field significant
–PSH - Push function
–RST - Reset the connection
–SYN - Synchronize sequence numbers
–FIN - No more data from sender
 These fields are referred to as flags, because the value of
one of these fields is only 1 bit and, therefore, has only two
values: 1 or 0. When a bit value is set to 1, it indicates what
control information is contained in the segment.
 Using a four-step process, flags are exchanged to terminate a
TCP connection.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 26


TCP three-Way Handshake - Step 1
 Using the Wireshark, examine the
operation of the TCP 3-way handshake:
 A TCP client begins the 3-way
handshake by sending a segment with
the SYN (Synchronize Sequence
Number) control flag set, indicating an
initial value in the sequence number
field in the header.
–This initial value for the sequence number,
known as the Initial Sequence Number (ISN), is
randomly chosen and is used to begin tracking
the flow of data from the client to the server for
this session.
 As shown in the figure, output from a
protocol analyzer shows the SYN
control flag and the relative sequence
number.
–The SYN control flag is set and the relative
sequence number is at 0.
–Although the protocol analyzer in the graphic
indicates the relative values for the sequence
and acknowledgement numbers, the true
values are 32 bit binary numbers.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 27


TCP three-Way Handshake - Step 2
 TCP server needs to acknowledge the receipt of
the SYN from the client to establish the session
from the client.
–The server sends a segment back to the client
with the ACK flag set indicating that the
Acknowledgment number is significant.
•With this flag set, the client recognizes this as an
acknowledgement that the server received the SYN
from the TCP client.
–The ACK flag will remain set for the balance of
the session.
 The value of acknowledgment number is the
initial sequence number plus 1.
–This establishes a session from the client to the
server.
 Server must also initiate the response from the
server to the client.
–To start this session, the server uses the SYN
flag in the same way that the client did.
–It sets the SYN flag in the header to establish a
session from server to the client.
–The SYN flag indicates that the initial value of the
sequence number field is in the header.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 28


TCP three-Way Handshake - Step 3
 Finally, the TCP client responds with a
segment containing an ACK that is the
response to the TCP SYN sent by the server.
–There is no user data in this segment.
–The value in the acknowledgment number field
contains one more than the initial sequence
number received from the server.
 Once both sessions are established between
client and server, all additional segments
exchanged in this communication will have the
ACK flag set.
 Security can be added to the network by:
–Denying the establishment of TCP sessions
–Only allowing sessions to be established for
specific services
–Only allowing traffic as a part of already
established sessions

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 29


TCP Session Termination
 To end TCP session, a two-way handshake is
used, consisting of a FIN and an ACK segment.
 Therefore, to terminate a single conversation
supported by TCP, four exchanges are needed to
end both sessions:
–1. When the client has no more data to send in the
stream, it sends a segment with the FIN flag set.
–2. The server sends an ACK to acknowledge the
receipt of the FIN to terminate the session from client
to server.
–3. The server sends a FIN to the client, to terminate
the server to client session.
–4. The client responds with an ACK to acknowledge
the FIN from the server.
 It is also possible to terminate the connection by a
three-way handshake.
–When the client has no more data to send, it sends a
FIN to the server. If the server also has no more data
to send, it can reply with both the FIN and ACK flags
set, combining two steps into one. The client replies
with an ACK.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 30


TCP Segment Reassembly
 When services send data using TCP, segments may arrive at
their destination out of order.
–For the original message to be understood by the recipient, and
reassembled into the original order, sequence numbers are assigned
in the header of each packet.
 During setup, an initial sequence number (ISN) is set.
–This ISN represents the starting value for the bytes that will be
transmitted to the receiving application.
–As data is transmitted, the sequence number is incremented by the
number of bytes that have been transmitted.
–This enables each segment to be uniquely identified and
acknowledged.
–Missing segments can be identified.
 The receiving TCP process places the data from a segment into a
receiving buffer.
–Any segments that arrive with noncontiguous sequence numbers are
held for later processing.
–Then, when the segments with the missing bytes arrive, these
segments are processed.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 31


TCP Acknowledgement with Windowing
 One of TCP's functions is making sure that each
segment reaches its destination.
–The TCP services on the destination host
acknowledge the data that it has received to the
source application.
 The segment sequence number and
acknowledgement number are used to confirm
receipt of the bytes of data in the segments.
–The sequence number is the relative number of
bytes that have been transmitted in this session plus
1.
–The sending host is expected to send a segment
that uses a sequence number that is equal to the
acknowledgement number.
•The source is informed that the destination has
received all bytes in this data up to, but not including, the
byte indicated by the acknowledgement number.
•This is called expectational acknowledgement.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 32


TCP Acknowledgement with Windowing
 In the example,
–the host on the left is sending data containing 10
bytes of data and a sequence number equal to 1 in the
header.
–The on the right receives the segment and
determines that the sequence number is 1 and that it
has 10 bytes of data.
•The host then sends a segment back to the host on the
left to acknowledge the receipt of this data.
•the host sets the acknowledgement number to 11 to
indicate that the next byte of data it expects to receive is
byte number 11.
–When the sending host on the left receives this
acknowledgement, it can now send the next segment
starting with byte number 11.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 33


TCP Acknowledgement: Sliding Window
 Looking at this example, if the sending host had to wait for
acknowledgement of the receipt of each 10 bytes, the
network would have a lot of overhead.
–To reduce the overhead of these acknowledgements,
multiple segments of data can be sent before and
acknowledged with a single TCP message.
–This acknowledgement contains an acknowledgement
number based on the total number of bytes received.
 For example, starting with a sequence number of 2000, if
10 segments of 1000 bytes each were received, an
acknowledgement number of 12001 would be returned to
the source.
 The amount of data that a source can transmit before an
acknowledgement must be received is called window size.
 [Tony]: What this slide is trying to describe is called:
Sliding Window
 See:
http://www.uic.rsu.ru/doc/inet
http://www.rhyshaden.com/tcp.htm /tcp_stevens/tcp_bulk.htm
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 34
TCP Acknowledgement with Windowing
 Length = 1460
No 1: SYN
No 2: SYN. ACK
No 3: ACK
No 4: SEQ = 1
No 5: SEQ = 566
No 6: ACT = 566 (for No. 5)
No 7: SEQ = 566 +1460 = 2026
No 8: SEQ = 2026 + 1460 = 3486
No 9: ACT = 2026 (for No. 7)
No 10: SEQ = 3486 + 1460 = 4946
No 11: SEQ = 4946 + 1460 = 6406
No 12: ACT = 3486 (for No. 8)
No 13: SEQ = 6406 + 1460 = 7866
No 14: ACT = 4946 (for No. 10)
No 15: ACT = 6406 (for No. 11)
No 16: ACT = 7866 (for No. 13)

zoo.cs.yale.edu/classes/cs433/assignments/assign2/TCP.pdf

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 35


TCP Retransmission
 No matter how well designed a network is, data loss will
occasionally occur.
–TCP provides methods of managing segment losses.
–These is a mechanism to retransmit segments with unacknowledged
data.
 A destination host service using TCP usually only acknowledges
data for contiguous sequence bytes.
–If one or more segments are missing, only the data in the segments
that complete the stream are acknowledged.
–For example, if segments with sequence numbers 1500 to 3000 and
3400 to 3500 were received, the acknowledgement number would be
3001.
•Because segments numbers 3001 to 3399 have not been received.

 When TCP at the source host has not received an


acknowledgement after a predetermined amount of time, it will go
back to the last acknowledgement number that it received and
retransmit data from that point forward.
 Hosts today may also employ an optional feature called Selective
Acknowledgements.
–If both hosts support Selective Acknowledgements, it is possible for
the destination to acknowledge bytes in discontinuous segments and
the host only need to retransmit the missing data.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 36


TCP Congestion Control – flow control
 TCP also provides mechanisms for flow control.
–Flow control assists the reliability of TCP transmission by
adjusting the effective rate of data flow between the two services.
–When the source is informed that the specified amount of data in
the segments is received, it can continue sending more data.
 This Window Size field in the TCP header specifies the
amount of data that can be transmitted before an
acknowledgement must be received.
–The initial window size is determined during the session startup
via the three-way handshake.
 See the figure for a simplified representation of window size
and acknowledgements.
–In this example, the initial window size for a TCP session
represented is set to 3000 bytes.
–When the sender has transmitted 3000 bytes, it waits for an
acknowledgement before transmitting more segments.
–Once the sender has received this acknowledgement, the
sender can transmit an additional 3000 bytes.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 37


TCP Congestion Control – flow control
 During the delay in receiving the acknowledgement,
the sender will not be sending any additional segments
for this session.
–In periods when the network is congested or the
resources of the receiving host are strained, the delay
may increase. As this delay grows longer, the effective
transmission rate of the data for this session decreases.
–The slowdown in data rate helps reduce the resource
contention.
 If the receiver indicates a window size of 0, then the
sender cannot send any more bytes until the receiver
sends a packet with a window size greater than 0.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 38


TCP Congestion Control – Reducing Window Size
 Another way to control the data flow is to use dynamic
window sizes.
–When network resources are constrained, TCP can
reduce the window size to require that received segments
be acknowledged more frequently.
–This effectively slows down the rate of transmission
because the source waits for data to be acknowledged
more frequently.
 If the destination needs to slow down the rate of
communication because of limited buffer memory, it
can send a smaller window size value to the source as
part of an acknowledgement.
–As shown in the figure, if a receiving host has
congestion, it may respond to the sending host with a
segment with a reduced window size.
 After periods of transmission with no data losses or
constrained resources, the receiver will begin to
increase the window field.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 39


TCP Congestion Control – Reducing Window Size
 This dynamic increasing and decreasing of
window size is a continuous process in TCP,
which determines the optimum window size for
each TCP session.
–In highly efficient networks, window sizes may
become very large because data is not being lost.
–In networks where the underlying infrastructure is
being stressed, the window size will likely remain
small.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 40


UDP:
Low Overhead vs. Reliability

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 41


UDP – Low Overhead vs. Reliability
 UDP is a simple protocol that provides the basic Transport
layer functions.
–It is not connection-oriented
–It does not provide retransmission, sequencing, and flow control.
 This does not mean that applications that use UDP are always
unreliable.
–It simply means that these functions are not provided by the
Transport layer protocol and must be implemented elsewhere if
required.
 key Application layer protocols that use UDP include:
–Domain Name System (DNS)
–Simple Network Management Protocol (SNMP)
–Dynamic Host Configuration Protocol (DHCP)
–Routing Information Protocol (RIP)
–Trivial File Transfer Protocol (TFTP)
–Online games
 If these applications used TCP, they may experience large
delays while TCP detects data loss and retransmits data.
–These delays would be more detrimental to the application than
small data losses.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 42


UDP Datagram Reassembly
 Because UDP is connectionless, sessions are not established
before communication takes place as they are with TCP.
–UDP is said to be transaction-based.
–In other words, when an application has data to send, it simply
sends the data.
 Many applications that use UDP send small amounts of data
that can fit in one segment.
–However, some applications will send larger amounts of data that
must be split into multiple segments.
–When multiple datagrams are sent to a destination, they may
take different paths and arrive in the wrong order.
–UDP does not keep track of sequence numbers.
–UDP has no way to reorder the datagrams into their transmission
order. See the figure.
 If the sequence of the data is important to the application, the
application will have to identify the proper sequence of the
data and determine how the data should be processed.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 43


UDP oddball protocol: TFTP
 The acknowledgement and retransmission
scheme was inspired by TCP, and the error
mechanism was suggested by PARC's EFTP
abort message.
 This protocol is very restrictive, in order to
simplify implementation. For example, the fixed
length blocks make allocation straight forward,
and the lock step acknowledgement provides
flow control and eliminates the need to reorder
incoming data packets.
–TFTP uses lockstep acknowledgement as both
flow control and a means of error correction. A
typical exchange would look like this:
"Here's the first letter."
"OK, got the first letter."
"Here's the second letter."
"OK, got the second letter."
http://www.cs.rpi.edu/~holli
ngd/eiw.2000/Notes/Protoc
ols/Protocols.html
© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 44
UDP Server Processes and Requests
 Like TCP-based applications, UDP-
based server applications are assigned
Well Known or Registered port numbers.
–When these applications or processes are
running, they will accept the data matched
with the assigned port number.
–When UDP receives a datagram destined for
one of these ports, it forwards the application
data to the appropriate application based on
its port number.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 45


UDP Client Processes
 As with TCP, client/server communication is initiated by a
client application that is requesting data from a server
process.
–The UDP client process randomly selects a port number from
the dynamic range of port numbers and uses this as the source
port for the conversation.
–The destination port will usually be the Well Known or
Registered port number assigned to the server process.
 Because there is no session to be created with UDP, as
soon as the data is ready to be sent and the ports identified,
UDP can form the datagram and pass it to the Network
layer to be addressed and sent on the network.
 Remember, once a client has chosen the source and
destination ports, the same pair of ports is used in the
header of all datagrams used in the transaction.
–For the data returning to the client from the server, the source
and destination port numbers in the datagram header are
reversed.

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 46


Summary

© 2006 Cisco Systems, Inc. All rights reserved. Cisco Public 47

You might also like