Documente Academic
Documente Profesional
Documente Cultură
Contents
1 Transport Layer Protocols 3
1.1 Introduction to the Transport Layer Protocols 4
1.2 Ports and Sockets 6
2 Transmission Control Protocol (TCP) 11
2.1 TCP Properties 12
2.2 TCP Header and Segment Format 16
2.3 TCP Connections 20
2.4 TCP Options 42
3 User Datagram Protocol (UDP) 45
3.1 UDP Properties 46
3.2 UDP Header and Datagram Format 56
4 Exercises 59
5 Solutions 75
TG7020XEN02GLA1
2009 Nokia Siemens Networks
1
Appendix - The Transport Layer
TG7020XEN02GLA1
2 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Fig. 1
TG7020XEN02GLA1
2009 Nokia Siemens Networks
3
Appendix - The Transport Layer
Multiplexing Services
For example, both UDP and TCP provide a multiplexing service to application
protocols by way of application-specific port numbers. Essentially, port numbers act
as virtual post office boxes for messages to be delivered to within a single host,
allowing multiple applications to run on a single host concurrently. When packets
arrive at destination system, they are handed off to the transport protocol specified in
the packet, which then delivers the transport-specific message data to the port
number specified in the header of the message. In this manner, many different
applications can run on the same host, using different port numbers to identify
themselves to the transport protocols.
TG7020XEN02GLA1
4 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Mechanisms
Mechanisms for
for
addressing
addressing higher
higher layer
layer
protocols
protocols
service assumed
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
5
Appendix - The Transport Layer
TG7020XEN02GLA1
6 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Port Numbers
Server Client
IP IP
Physical Physical
S D
D S
TCP/IP
BOOTP
BOOTP
Telnet
SNMP
WWW
SMTP
Telnet
SNMP
TFTP
WWW
SMTP
Layers
TFTP
DNS
FTP
DNS
FTP
44
33 TCP
TCP UDP
UDP
EGP
EGP ICMP
ICMP OSPF
OSPF
Protocol Numbers
22 08 06 01 17 89
ARP
ARP IP
IP RARP
RARP
TG7020XEN02GLA1
2009 Nokia Siemens Networks
7
Appendix - The Transport Layer
Sockets
The socket interface is one of several application programming interfaces (APIs) to
the communication protocols. Designed to be a generic communication-programming
interface, APIs were first introduced by 4.2 BSD (Berkeley Software Distribution).
Although it has not been standardized, it has become a de facto industry standard.
Let us consider the following terminologies:
Term Description
Socket Special type of file handle, which is used by a process to request
network services from the operating system.
Socket Address The triple: <protocol, local-address, local-process>
For example, in the TCP/IP suite: <tcp, 193.44.234.3, 12345>
Conversation Communication link between two processes.
Association The 5-tuple that completely specifies the two processes that
comprise a connection: <protocol, local-address, local-process,
foreign-address, foreign-process>
In the TCP/IP suite, the following could be a valid association:
<tcp, 193.44.234.3, 1500, 193.44.234.5, 21>
Half- Either <protocol, local-address, local-process> or
association <protocol, foreign-address, foreign-process> which specify
each half of a connection.
The half-association is also called a socket or a transport address. That is, a socket
is an endpoint for communication that can be named and addressed in a network.
Two processes communicate via TCP sockets. The socket model provides a process
with a full-duplex byte stream connection to another process. The application need
not concern itself with the management of this stream; these facilities are provided by
TCP.
SUMMARY
TCP uses the same port principle as UDP to provide multiplexing. Like UDP, TCP
uses well-known and ephemeral ports. Each side of a TCP connection has a socket
that can be identified by the triple <TCP, IP address, port number>. If two processes
are communicating over TCP, they have a logical connection that is uniquely
identifiable by the two sockets involved, that is, by the combination <TCP, local IP
address, local port, remote IP address, remote port>. Server processes are able to
manage multiple conversations through a single port.
TG7020XEN02GLA1
8 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Sockets
Association The 5-tuple that completely specifies the two processes that comprise
a connection: <protocol, local-address, local-process, foreign-
address, foreign-process>
In the TCP/IP suite, the following could be a valid association: <tcp,
193.44.234.3, 1500, 193.44.234.5, 21>
Fig. 5 Sockets
Client
Client A
A HTTP
HTTP Server
Server Client
Client B
B
IP
IP Addr.:10.27.51.3
Addr.:10.27.51.3 IP
IP Addr.:10.27.51.1
Addr.:10.27.51.1 IP
IP Addr.:10.27.51.2
Addr.:10.27.51.2
Port
Port Number:
Number: 1127
1127 Port
Port Number:
Number: 80
80 Port
Port number:
number: 1084
1084
10.27.51.3:1127
10.27.51.3:1127 10.27.51.3:1084
10.27.51.3:1084
10.27.51.1:80
10.27.51.1:80 10.27.51.1:80
10.27.51.1:80
TG7020XEN02GLA1
2009 Nokia Siemens Networks
9
Appendix - The Transport Layer
TG7020XEN02GLA1
10 2009 Nokia Siemens Networks
Appendix - The Transport Layer
TG7020XEN02GLA1
2009 Nokia Siemens Networks
11
Appendix - The Transport Layer
TIP
TCP is used by many of the popular applications, such as web browsing (HTTP),
electronic mail (SMTP), Telnet, FTP, etc., which require the reliability offered by TCP.
TG7020XEN02GLA1
12 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Application Application
Transport Transmission
Transmission Control
Control Protocol
Protocol TCP
TCP Transport
Transport Transport
Network Network Network Network
Data Link Data Link Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical Physical Physical
Unreliable
IP Packets
IP IP
TG7020XEN02GLA1
2009 Nokia Siemens Networks
13
Appendix - The Transport Layer
Basic Data The TCP is able to transfer a continuous stream of octets in each
Transfer: direction between its users by packaging some number of octets into
segments for transmission through the IP network. In general, the
TCPs decide when to block and forward data at their own
convenience.
Reliability: The TCP must recover from data that is damaged, lost, duplicated,
or delivered out of order by the IP network. This is achieved by
assigning a sequence number to each octet transmitted, and
requiring a positive acknowledgment (ACK) from the receiving TCP.
If the ACK is not received within a timeout interval, the data is
retransmitted. At the receiver, the sequence numbers are used to
correctly order segments that may be received out of order and to
eliminate duplicates. Damage is handled by adding a checksum to
each segment transmitted, checking it at the receiver, and
discarding damaged segments.
Flow Control: TCP provides a means for the receiver to control the amount of data
sent by the sender. This is achieved by returning a "window" with
every ACK indicating a range of acceptable sequence numbers
beyond the last segment successfully received. The window
indicates an allowed number of octets that the sender may transmit
before receiving further permission.
Multiplexing: To allow for many processes within a single host system to use TCP
communication facilities simultaneously, the TCP provides a set of
addresses or ports within each host. Concatenated with the IP
addresses, this forms a socket. A pair of sockets uniquely identifies
each connection.
Connections: The reliability and flow control mechanisms require that TCPs
maintain certain status information for each data stream. The
combination of this information, including sockets, sequence
numbers, and window sizes, is called a connection. A pair of sockets
identifying its two sides uniquely specifies each connection. When
two processes wish to communicate, their TCP's must first establish
a connection. When their communication is complete, the
connection is closed to free the resources for other uses.
Precedence The users of TCP may indicate the security and precedence of their
and Security: communication. Provision is made for default values to be used
when these features are not needed.
TG7020XEN02GLA1
14 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Basic
Basic Data
Data Transfer
Transfer
(Full
(Full Duplex)
Duplex)
Reliability
Reliability
-- TCP
TCP recovers
recovers from
from data
data that
that is
is damaged,
damaged, lost,
lost,
duplicated,
duplicated, or
or delivered
delivered out
out of
of order
order
Flow
Flow control
control
-- by
by window
window size
size information
information
Multiplexing
Multiplexing // TCP
TCP Ports
Ports
(e.g.
(e.g. TELNET
TELNET -- port
port number
number 23)
23)
Connections
Connections
-- uniquely
uniquely specified
specified by
by aa pair
pair of
of sockets
sockets
Optional
Optional Indication
Indication of
of Precedence
Precedence and
and Security
Security
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
15
Appendix - The Transport Layer
TG7020XEN02GLA1
16 2009 Nokia Siemens Networks
Appendix - The Transport Layer
IP
IP Header
Header TCP
TCP Header
Header TCP
TCP Data
Data
TCP Segment
IP Packet
0 16 31
Data
TG7020XEN02GLA1
2009 Nokia Siemens Networks
17
Appendix - The Transport Layer
TG7020XEN02GLA1
18 2009 Nokia Siemens Networks
Appendix - The Transport Layer
0 16 31
Sequence Number
Data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
19
Appendix - The Transport Layer
General
Applications communicate with each other using the virtual circuits provided by TCP.
These circuits are established on an as-needed basis, getting set up and torn down
as requested by the applications in use. Whenever an application needs to
communicate with another application somewhere on the network, it will ask the local
TCP module to establish a virtual circuit on its behalf.
There are two methods for requesting a virtual circuit to be opened: either an client
will request an "OPEN" so that data can be sent immediately, or a server will "OPEN"
a port in "listen" mode, waiting for a connection request to arrive from a client.
Passive OPEN
The most simple of the two methods is the passive "OPEN", which is the form used
by servers that want to listen for incoming connections. A passive "OPEN" indicates
that the server is willing to accept incoming connection requests from other systems,
and that it does not want to initiate an outbound connection. Typically a passive
"OPEN" is "unqualified", meaning the server can accept an incoming connection from
anybody. However, some security sensitive applications will accept connections from
predefined entities, a condition known as qualified passive "OPEN".
When a publicly accessible server first gets started, it will request that TCP to
"OPEN" a well-known port in passive mode, offering connectivity to any node that
sends in a connection request. Any TCP connection requests that come into that
system destined for that port number would result in a new virtual circuit being
established.
TG7020XEN02GLA1
20 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Telnet Telnet
OPEN (local port, foreign socket, passive, etc.) local
connection name
local port = 23
. . . Port 23 .
. foreign socket =
unspecified/specified LISTEN
TCB
Unreliable
IP Packets
IP IP
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
21
Appendix - The Transport Layer
Active OPEN
Client applications (e.g. a web browser) use active "OPEN" when making these
connection requests. An active "OPEN" is the opposite of an passive "OPEN" , in that
it is a specific request to establish a virtual circuit with a specific destination socket
(typically this will be the well known port number of the server that is associated with
the specific client). On an active "OPEN" command, the TCP will begin the procedure
to synchronize (i.e., establish) the connection at once.
TG7020XEN02GLA1
22 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Unreliable
IP Packets
IP IP
TCB
Local socket number
Remote socket number
Security and precedence of the connection
Pointers to the user's send and receive buffers
Pointer to the retransmit queue
Pointer to the current segment
Variables relating to the send and receive sequence numbers
TG7020XEN02GLA1
2009 Nokia Siemens Networks
23
Appendix - The Transport Layer
TG7020XEN02GLA1
24 2009 Nokia Siemens Networks
Appendix - The Transport Layer
0 16 31
Sequence Number
Acknowledgement Number
U A P R S F
Data
Reserved R C S S Y I Window
Offset
G K H T N N
Telnet
Telnet Connect
Connect
Three-way Handshake"
SYN SN=1690412290 , ACK= 50628
TG7020XEN02GLA1
2009 Nokia Siemens Networks
25
Appendix - The Transport Layer
TG7020XEN02GLA1
26 2009 Nokia Siemens Networks
Appendix - The Transport Layer
TG7020XEN02GLA1
2009 Nokia Siemens Networks
27
Appendix - The Transport Layer
2.3.2.1 General
Once a virtual circuit has been established, the applications in use can begin
exchanging data with each other. However, as we know, the applications do not
exchange data directly. Rather, each application hands data to its local TCP module,
identifying the specific destination socket that the data is for and TCP does the rest.
Applications can pass data to TCP in chunks or as contiguous byte stream. Most
TCP implementations provide a "write" service that is restricted in size, forcing
applications to write data in blocks, just as if they were writing data to file on the local
hard drive. However, TCPs buffering design also supports application writes that are
contiguous, and this design is used in a handful of implementations.
TCP stores the data that it receives into a local send buffer. Periodically, a chunk of
data will get sent to the destination system. The recipient TCP software will then
store this data into a receive buffer, where it will be eventually passed to the
destination application.
TIP
The important thing to remember here is that application data is transmitted as
independent TCP segments, each of which requires acknowledgements. It is at this
layer that TCP's reliability and flow control services become most visible.
TG7020XEN02GLA1
28 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Application SEND
Client Inter Process Server
Communication
Telnet Telnet
Unreliable
IP Packets
IP IP
Application RECEIVE
Client Inter Process Server
Communication
Telnet Telnet
Unreliable
IP Packets
IP IP
TG7020XEN02GLA1
2009 Nokia Siemens Networks
29
Appendix - The Transport Layer
TIP
While this mechanism ensures reliability, it only uses a part of the available network
bandwidth.
Consider now a protocol where the sender groups its packets to be transmitted as in
the figure below and uses the following rules:
The sender can send all packets within the window without receiving an ACK, but
must start a timeout timer for each of them.
The receiver must acknowledge each packet received, indicating the sequence
number of the last well-received packet.
The sender slides the window on each ACK received.
The sender can transmit packets 1 to 5 without waiting for any acknowledgment as
shown in figure 23.
At the moment the sender receives ACK 1 (acknowledgment for packet 1), it can
slide its window one packet to the right (see figure 24).
At this point, the sender may also transmit packet 6.
Packet 2 gets lost
The sender will not receive ACK 2, so its window will remain in position 1 (as in
Figure 23). In fact, since the receiver did not receive packet 2, it will acknowledge
packets 3, 4 and 5 with an ACK 1, since packet 1 was the last one received in
sequence. At the sender's side, eventually a timeout will occur for packet 2 and it will
be retransmitted. Note that reception of this packet by the receiver will generate ACK
5, since it has now successfully received all packets 1 to 5, and the sender's window
will slide four positions upon receiving this ACK 5.
Packet 2 did arrive, but the acknowledgment gets lost:
The sender does not receive ACK 2, but will receive ACK 3. ACK 3 is an
acknowledgment for all packets up to 3 (including packet 2) and the sender can now
slide its window to packet 4.
This window mechanism ensures:
Reliable transmission.
Better use of the network bandwidth (better throughput).
Flow-control, since the receiver may delay replying to a packet with an
acknowledgment, knowing its free buffers available and the window-size of the
communication.
TG7020XEN02GLA1
30 2009 Nokia Siemens Networks
Appendix - The Transport Layer
0 16 31
Sequence Number
Data
Send packet 1
Receive packet 1 and
reply with an ACK 1
Receive ACK
Send packet 2
1 2 3 4 5 6 7 8 9 .. packets
window
TG7020XEN02GLA1
2009 Nokia Siemens Networks
31
Appendix - The Transport Layer
TIP
Remember that TCP will block bytes into segments, and a TCP segment only carries
the sequence number of the first byte in the segment.
TG7020XEN02GLA1
32 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Send packet 1
Send packet 2
Send packet 3
Send packet 4
Receive ACK for packet 1 ACK 1
Send packet 5
1 2 3 4 5 6 7 8 9 .. packets
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .. bytes
A
A B
B C
C D
D
TG7020XEN02GLA1
2009 Nokia Siemens Networks
33
Appendix - The Transport Layer
TG7020XEN02GLA1
34 2009 Nokia Siemens Networks
Appendix - The Transport Layer
TG7020XEN02GLA1
2009 Nokia Siemens Networks
35
Appendix - The Transport Layer
TIP
This is an important feature, because delays can vary in IP network, depending on
multiple factors, such as the load of an intermediate low-speed network or the
saturation of an intermediate IP router.
TG7020XEN02GLA1
36 2009 Nokia Siemens Networks
Appendix - The Transport Layer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
37
Appendix - The Transport Layer
General
Once the applications have exchanged all of their data, the circuit can be closed.
Closing the circuit is similar to opening one, in that an application must request the
action (except in those cases where the connection has collapsed, and TCP is forced
to terminate it). Either end of the connection may close the circuit at any time, using a
variety of different means. The two common ways to close are "active closes" that
initiate a shutdown sequence and "passive closes" that respond to an active close
request.
Just as building a circuit requires a bidirectional exchange of special command
segments, so does closing it. One end of the connection requests that the circuit be
closed (the active close at work). The remote system then acknowledges the
termination request and responds with its own termination request (the passive
close). The terminating system then acknowledges the acknowledgement, and both
endpoints drop the circuit. At this point, neither system is able to send any more data
over the virtual circuit.
TG7020XEN02GLA1
38 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Telnet
Telnet Disconnect
Disconnect
TG7020XEN02GLA1
2009 Nokia Siemens Networks
39
Appendix - The Transport Layer
TG7020XEN02GLA1
40 2009 Nokia Siemens Networks
Appendix - The Transport Layer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
41
Appendix - The Transport Layer
Options may occupy space at the end of the TCP header and are a multiple of 8 bits
in length. All options are included in the checksum. An option may begin on any octet
boundary. There are two cases for the format of an option:
Case 1: A single octet of option-kind.
Case 2: An octet of option-kind, an octet of option-length, and the actual option-
data octets.
TIP
The option-length counts the two octets of option-kind and option-length as well as
the option-data octets. The list of options may be shorter than the data offset field
might imply. The content of the header beyond the End-of-Option option must be
header padding (i.e., zero).
TG7020XEN02GLA1
42 2009 Nokia Siemens Networks
Appendix - The Transport Layer
TCP Options
Kind Name Description
0 End of Option List Used to mark the end of all the options.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
43
Appendix - The Transport Layer
TG7020XEN02GLA1
44 2009 Nokia Siemens Networks
Appendix - The Transport Layer
TG7020XEN02GLA1
2009 Nokia Siemens Networks
45
Appendix - The Transport Layer
UDP Services
One may wonder why a UDP protocol exists, when it would seem that IP could serve
the same function. The reason is simple: IP doesn't do anything but get packets from
one host to another. IP doesn't provide any application interfaces or management
services. UDP does provide these services, and it provides a consistent environment
for developers to use when writing low-overhead network applications. UDP also
provides application-multiplexing services through the use of port numbers, allowing
many application protocols to be used on a single host.
Message-centric Model
Another benefit of UDP is that it offers a message-centric model, allowing chunks of
data to be sent as single IP packets. For example, a UDP based application protocol
can write a four-kilobyte block of data to UDP, and that block will be handed to IP
directly. IP will then create an IP packet that contains the entire four kilobytes, and
send this data as a series of fragmented IP packets to the destination system. Once
all of the data arrives, the original IP packet is reassembled and the entire four-
kilobyte UDP message will be handed to UDP for processing. In this model, it is very
easy for applications to exchange record-oriented data (e.g. database records), since
the entire record can be read by a single operation.
Lightweight Protocol
Also, applications that need fast response times or that already have their own
internal error-correction routines can make good use of UDP because of its low
overhead. Some database software packages can be configured to use UDP, and
some file transfer protocols also use UDP because it is a light, fast, and message
centric protocol that is easier and faster than TCP, and that does not require the
overhead of TCP's virtual circuit model.
TG7020XEN02GLA1
46 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Application Application
User
User Datagram
Datagram Protocol
Protocol UDP
UDP
Transport
Transport Transport
Transport
Network Network Network Network
Data Link Data Link Data Link Data Link Data Link Data Link Data Link
Physical Physical Physical Physical Physical Physical Physical
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
47
Appendix - The Transport Layer
TG7020XEN02GLA1
48 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Lightweight-Protocol
Lightweight-Protocol
-- Low
Low Overhead
Overhead
Limited
Limited Reliability
Reliability
-- UDP
UDP does
does not
not recover
recover from
from data
data that
that is
is damaged,
damaged,
lost,
lost, duplicated,
duplicated, or
or delivered
delivered out
out of
of order
order
Message-centric
Message-centric
Multiplexing
Multiplexing // UDP
UDP Ports
Ports
(e.g.
(e.g. TFTP
TFTP -- port
port number
number 69)
69)
Connectionless
Connectionless
Broadcast
Broadcast and
and Multicast
Multicast Capability
Capability
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
49
Appendix - The Transport Layer
UDP Checksum
Furthermore, UDP also provides a checksum service that allows a receiving UDP to
verify that whatever data has arrived is probably the same as that which was sent.
The use of UDP's checksum is optional but recommended, and not all of the
applications that use UDP also use the checksum service.
TG7020XEN02GLA1
50 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Error
Error Tolerant
Tolerant Applications
Applications
Application
Application Specific
Specific Error
Error Correction
Correction
Underlying
Underlying Network
Network Reliability
Reliability
UDP
UDP Checksum
Checksum
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
51
Appendix - The Transport Layer
TG7020XEN02GLA1
52 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Datagram-centric Transport
Client Server
Application
Application Data
Data Data
Data Application
Application
UDP
UDP UDP Datagram UDP Datagram UDP
UDP
IP Packet IP Packet
IP
IP IP
IP
Physical
Physical Physical
Physical
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
53
Appendix - The Transport Layer
TG7020XEN02GLA1
54 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Port Numbers
Server Client
IP IP
Physical Physical
S D
D S
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
55
Appendix - The Transport Layer
TG7020XEN02GLA1
56 2009 Nokia Siemens Networks
Appendix - The Transport Layer
UDP
UDP
IP
IP Header
Header UDP
UDP Data
Data
Header
Header
UDP Datagram
IP Packet
0 16 31
Data
TG7020XEN02GLA1
2009 Nokia Siemens Networks
57
Appendix - The Transport Layer
0 16 31
Data
Padding (0)
TG7020XEN02GLA1
58 2009 Nokia Siemens Networks
Appendix - The Transport Layer
4 Exercises
TG7020XEN02GLA1
2009 Nokia Siemens Networks
59
Appendix - The Transport Layer
TG7020XEN02GLA1
60 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Exercise 1
Title: Transport Layer Protocols
Task
2. Mark the correct statements below. The concepts of port and socket are needed
to determine which local process at a given host actually communicates with
which:
remote process
remote host
using which network layer protocol
using which transport layer protocol
TG7020XEN02GLA1
2009 Nokia Siemens Networks
61
Appendix - The Transport Layer
4. Mark the correct statement below. Clients do not need well-known port numbers
because they initiate communication with servers and the port number they are
using is contained in the TCPsegments/UDP datagrams sent to the server.
True
False
Term Description
Socket Special type of file handle, which is used by a process to
____________________________________________________
____________________________________________________
Socket Address
The triple: <_________________________________________>
Conversation
____________________________________________________
Association
The ____________________that completely specifies the two
___________________________________________________>
Half-
association Either <___________________________________________> or
<__________________________________________________>
which specify each half of a connection.
TG7020XEN02GLA1
62 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Exercise 2
Title: TCP Properties
Task
2. Mark the characteristics listed below, which you associate with the Basic Data
Transfer capability of the Transmission Control Protocol:
transfer a continuous stream of octets in each direction between its users by
packaging some number of octets into segments for transmission through the IP
network
transfer a continuous stream of octets in one direction between a sending user and
a receiving user by packaging some number of octets into segments for
transmission through the IP network
TCP decides when to block and forward data
Application programs decide when to block and forward data
TG7020XEN02GLA1
2009 Nokia Siemens Networks
63
Appendix - The Transport Layer
3. To achieve reliability, the TCP must recover from data that is damaged, lost,
duplicated, or delivered out of order by the IP network. Describe, how this is
achieved in principle.
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
4. Mark the characteristics listed below, which you associate with the Flow Control
capability of the Transmission Control Protocol:
the receiver controls the amount of data sent by the sender
the sender controls the amount of data sent
the window indicates an allowed number of octets a sender may transmit
___________________________________________________________________
___________________________________________________________________
TG7020XEN02GLA1
64 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Exercise 3
Title: TCP Header and Segment Format
Objectives: Delegates are able to name the TCP Header fields and
describe their tasks
Pre-requisite: None
Task
TG7020XEN02GLA1
2009 Nokia Siemens Networks
65
Appendix - The Transport Layer
TG7020XEN02GLA1
66 2009 Nokia Siemens Networks
Appendix - The Transport Layer
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
67
Appendix - The Transport Layer
TG7020XEN02GLA1
68 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Exercise 4
Title: TCP Virtual Connections
Objectives: Delegates are able to explain the basic concept of TCP virtual
connections
Pre-requisite: None
Task
___________________________________________________________________
_______________________________________________________________
__
___________________________________________________________________
_______________________________________________________________
__
___________________________________________________________________
TG7020XEN02GLA1
2009 Nokia Siemens Networks
69
Appendix - The Transport Layer
Telnet
Telnet Connect
Connect
Three-way Handshake"
A TCP segment only carries the sequence number of the first packet in the
segment.
TG7020XEN02GLA1
70 2009 Nokia Siemens Networks
Appendix - The Transport Layer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .. bytes
A
A B
B C
C D
D
_________________________________________________________________
Which event advances the leading edge of the sliding window?
_________________________________________________________________
How is the total window size determined?
_________________________________________________________________
5. There are essentially three cases closing a virtual circuit: List them!
_______________________________ ________________________
_______________________________
TG7020XEN02GLA1
2009 Nokia Siemens Networks
71
Appendix - The Transport Layer
TG7020XEN02GLA1
72 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Exercise 5
Title: User Datagram Protocol UDP
TG7020XEN02GLA1
2009 Nokia Siemens Networks
73
Appendix - The Transport Layer
32 Bits
0 16 31
1 UDP
2 Header
TG7020XEN02GLA1
74 2009 Nokia Siemens Networks
Appendix - The Transport Layer
5 Solutions
TG7020XEN02GLA1
2009 Nokia Siemens Networks
75
Appendix - The Transport Layer
TG7020XEN02GLA1
76 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Solution 1
Title: Transport Layer Protocols
Task
2. Mark the correct statements below. The concepts of port and socket are needed
to determine which local process at a given host actually communicates with
which:
remote process
remote host
using which network layer protocol
using which transport layer protocol
TG7020XEN02GLA1
2009 Nokia Siemens Networks
77
Appendix - The Transport Layer
4. Mark the correct statement below. Clients do not need well-known port numbers
because they initiate communication with servers and the port number they are
using is contained in the TCPsegments/UDP datagrams sent to the server.
True
False
Term Description
Socket Special type of file handle, which is used by a process to request
network services from the operating system.
Socket Address The triple: <protocol, local-address, local-process>
Conversation Communication link between two processes.
Association The 5-tuple that completely specifies the two processes that
comprise a connection: <protocol, local-address, local-process,
foreign-address, foreign-process>
Half- Either <protocol, local-address, local-process> or
association <protocol, foreign-address, foreign-process> which specify
each half of a connection.
TG7020XEN02GLA1
78 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Solution 2
Title: TCP Properties
Objectives: Delegates are able to name the properties of the Transmission
Control Protocol TCP
Pre-requisite: None
Task
2. Mark the characteristics listed below, which you associate with the Basic Data
Transfer capability of the Transmission Control Protocol:
transfer a continuous stream of octets in each direction between its users by
packaging some number of octets into segments for transmission through the IP
network
transfer a continuous stream of octets in one direction between a sending user and
a receiving user by packaging some number of octets into segments for
transmission through the IP network
TCP decides when to block and forward data
Application programs decide when to block and forward data
TG7020XEN02GLA1
2009 Nokia Siemens Networks
79
Appendix - The Transport Layer
3. To achieve reliability, the TCP must recover from data that is damaged, lost,
duplicated, or delivered out of order by the IP network. Describe, how this is
achieved in principle.
It is achieved by assigning a sequence number to each octet transmitted,
and requiring a positive acknowledgment (ACK) from the receiving TCP. If
the ACK is not received within a timeout interval, the data is retransmitted.
At the receiver, the sequence numbers are used to correctly order segments
that may be received out of order and to eliminate duplicates. Damage is
handled by adding a checksum to each segment transmitted, checking it at
the receiver, and discarding damaged segments.
4. Mark the characteristics listed below, which you associate with the Flow Control
capability of the Transmission Control Protocol:
the receiver controls the amount of data sent by the sender
the sender controls the amount of data sent
the window indicates an allowed number of octets a sender may transmit
TG7020XEN02GLA1
80 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Solution 3
Title: TCP Header and Segment Format
Objectives: Delegates are able to name the TCP Header fields and
describe their tasks
Pre-requisite: None
Task
TG7020XEN02GLA1
2009 Nokia Siemens Networks
81
Appendix - The Transport Layer
TG7020XEN02GLA1
82 2009 Nokia Siemens Networks
Appendix - The Transport Layer
0 16 31
Sequence Number
Data
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TG7020XEN02GLA1
2009 Nokia Siemens Networks
83
Appendix - The Transport Layer
TG7020XEN02GLA1
84 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Solution 4
Title: TCP Virtual Connections
Objectives: Delegates are able to explain the basic concept of TCP virtual
connections
Pre-requisite: None
Task
TG7020XEN02GLA1
2009 Nokia Siemens Networks
85
Appendix - The Transport Layer
Telnet
Telnet Connect
Connect
A TCP segment only carries the sequence number of the first packet in the
segment.
TG7020XEN02GLA1
86 2009 Nokia Siemens Networks
Appendix - The Transport Layer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 .. bytes
A
A B
B C
C D
D
5. There are essentially three cases closing a virtual circuit: List them!
Local application initiates the close
Local TCP receives a FIN from the network
Both users close simultaneously
TG7020XEN02GLA1
2009 Nokia Siemens Networks
87
Appendix - The Transport Layer
TG7020XEN02GLA1
88 2009 Nokia Siemens Networks
Appendix - The Transport Layer
Solution 5
Title: User Datagram Protocol UDP
TG7020XEN02GLA1
2009 Nokia Siemens Networks
89
Appendix - The Transport Layer
32 Bits
0 16 31
Data
TG7020XEN02GLA1
90 2009 Nokia Siemens Networks