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

Unit 4 - Transport Layer

The document discusses the transport layer and its key functions and protocols. It describes the transport service and primitives, addressing using ports, connection establishment using three-way handshake, connection release using symmetric methods, and error control and flow control mechanisms like sequencing, acknowledgments and sliding windows.

Uploaded by

bd29012004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Unit 4 - Transport Layer

The document discusses the transport layer and its key functions and protocols. It describes the transport service and primitives, addressing using ports, connection establishment using three-way handshake, connection release using symmetric methods, and error control and flow control mechanisms like sequencing, acknowledgments and sliding windows.

Uploaded by

bd29012004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

Chapter 6

The Transport Layer


The Transport Layer
• The Transport Service
• Elements of Transport Protocols
• Connection Management
• UDP
• TCP
Introduction
 Together with the network layer, the transport
layer is the heart of the protocol hierarchy.
 The network layer provides end-to-end packet
delivery using datagrams or virtual circuits.
 The transport layer builds on the network layer
to provide data transport from a process on a
source machine to a process on a destination
machine with a desired level of reliability.
The Transport Service
• Services Provided to the Upper Layers
• Transport Service Primitives
• Berkeley Sockets
• An Example of Socket Programming:
– An Internet File Server
Services Provided to the Upper Layers
 The ultimate goal of the transport layer is to provide efficient, reliable, and
cost-effective data transmission service to its users, normally processes in
the application layer.
 The software and/or hardware within the transport layer that does the
work is called the transport entity.

Figure: The network, transport, and application layers.


Services Provided to the Upper Layers
Transport Layer provides two types of services

1. Connection-oriented Service (TCP)


2. Connectionless Service (UDP)
 The connection-oriented transport service have three phases:
establishment, data transfer, and release.

 Difference between N/W Layer Services and Transport layer


services:
i. The transport primitives can be implemented as calls to
library procedures to make them independent of the
network primitives.
ii. Network service is generally unreliable.
iii. The connection-oriented transport service is reliable.
Transport Service Primitives

Table: The primitives for a simple transport service.


Transport Service Primitives (3)

Figure: A state diagram for a simple connection management scheme.


 Transitions labeled in italics are caused by packet arrivals.
 The solid lines show the client's state sequence.
 The dashed lines show the server's state sequence.
Transport Service Primitives (2)

Segment

The nesting of TPDUs, packets, and frames.


Berkeley Sockets
 Another set of transport primitives, the socket primitives are used for
TCP.
 Sockets were first released as part of the berkeley Unix 4.2 BSD
software distribution in 1983.

Table: The socket primitives for TCP.


Berkeley Sockets
Server Side:
 The first four primitives in the list are executed in that order by
servers.
 The SOCKET primitive creates a new endpoint and allocates table space
for it within the transport entity.
 Spcket Network addresses are assigned using the BIND primitive.
 LISTEN call allocates space to queue incoming calls.
 To block waiting for an incoming connection, the server executes an
ACCEPT primitive.
Client Side:
 Socket must first be created using the SOCKET primitive.
 The CONNECT primitive blocks the caller and actively starts the
connection process. ------- connection established both sides ---------
Both sides can now use SEND and RECEIVE to transmit and
receive data over the full-duplex connection
Connection release with sockets is symmetric. When both sides have
executed a CLOSE primitive, the connection is released.
Berkeley Sockets
 Sockets have proved tremendously popular and are
standard for abstracting transport services to applications.
 The socket API is often used with the TCP protocol to
provide a connection-oriented service called a reliable byte
stream.
Socket
Programming
Example:
Internet File
Server
6-6-1

Client code using


sockets.
Socket
Programming
Example:
Internet File
Server (2)

Client code using


sockets.
Elements of Transport Protocols
The transport service is implemented by a transport
protocol used between the two transport entities.

• Addressing
• Connection Establishment
• Connection Release
• Flow Control and Buffering
• Multiplexing
• Crash Recovery
Transport Protocol

(a) Environment of the data link layer. (b) Environment of the transport layer.

 Difference between Data link Layer and Transport layer:


i. At the data link layer, two routers communicate directly
via a physical channel vs at the transport layer, this
physical channel is replaced by the entire network
ii. Another difference is the potential existence of storage
capacity in the network.
Addressing
 When an application
process wishes to
communicate with a remote
application process, it must
specify which one to
connect to or send to
message.

 In the Internet, these


endpoints are called ports.

 TSAP (Transport Service


Access Point) = ports

 NSAPs (Network Service


Access Points)= IP
addresses

 Portmapper
Figure: TSAPs, NSAPs and transport connections.
Addressing
A possible scenario for a transport connection is as follows:
1. A mail server process attaches itself to TSAP 1522 on host 2 to wait
for an incoming call. How a process attaches itself to a TSAP is
outside the networking model and depends entirely on the local
operating system. A call such as our LISTEN might be used, for
example.
2. An application process on host 1 wants to send an email message, so it
attaches itself to TSAP 1208 and issues a CONNECT request. The
request specifies TSAP 1208 on host 1 as the source and TSAP 1522
on host 2 as the destination. This action ultimately results in a
transport connection being established between the application
process and the server.
3. The application process sends over the mail message.
4. The mail server responds to say that it will deliver the message.
5. The transport connection is released.
Addressing

Figure: How a user process in host 1 establishes a connection with a time-of-day server in host 2.

Each machine that wishes to offer services to remote users has a special
process server that acts as a proxy for less heavily used servers. This server
is called inetd on UNIX systems.
Addressing
Addressing: Port Numbers
Process-to-process communication is achieved through
the client-server paradigm.
A process on the local host, called a client, needs services
from a process usually on the remote host, called a server.

For communication, we must define the local host, local


process, remote host, and remote process.
The local host and the remote host are defined using IP
addresses.
To define the processes, we need second identifiers,
called port numbers.
Addressing

Addressing: Port Numbers

The port numbers are integers between 0 and 65535


(16 bits.)

The client program defines itself with a port number,


called the ephemeral port number.

The server program defines with a port number, called the


well-known port number.

23.21
Addressing

Figure 23.3: Port numbers


Addressing
Figure : IP addresses versus port numbers
Addressing
Figure: ICANN ranges
Figure: Socket address

A transport layer protocol needs both IP address and the port number,
at each end to make a connection.
The combination of an IP address and a port number is called a socket
address.
To use service we need a pair of socket addresses: the client socket
address and the server socket address of the transport layer in the
Internet.
Connection Establishment –
Three-way handshake

Three protocol scenarios for establishing a connection using a


three-way handshake. CR denotes CONNECTION REQUEST.
(a) Normal operation,
(b) Old CONNECTION REQUEST appearing out of nowhere.
(c) Duplicate CONNECTION REQUEST and duplicate ACK.
PAWS (Protection Against Wrapped Sequence numbers – 32 bit)
Connection Release

 Two styles of terminating a


connection: asymmetric release
and symmetric release
 Asymmetric release when one
party hangs up, the connection is
broken. (off-close)
 Symmetric release treats the
connection as two separate
unidirectional connections and
requires each one to be released
separately.

Figure: Abrupt disconnection with loss of data.


Connection Release (2)

Figure: The two-army problem.

Solution – Three way handshaking release


Connection Release (3)

6-14, a, b

Four protocol scenarios for releasing a connection. (a) Normal case of a


three-way handshake. (b) final ACK lost.
Connection Release (4)

6-14, c,d

(c) Response lost. (d) Response lost and subsequent DRs lost.
Error Control and Flow Control
The solutions that are used at the transport layer(end-to-end)
are the same mechanisms used at the data link layer(link-to-
link).
1. A segment carries an error-detecting code (e.g., a CRC or checksum) that
is used to check if the information was correctly received.
2. A segment carries a sequence number to identify itself and is retransmitted
by the sender until it receives an acknowledgement of successful receipt
from the receiver. This is called ARQ (Automatic Repeat reQuest).
3. There is a maximum number of segments that the sender will allow to be
outstanding at any time, pausing if the receiver is not acknowledging
frames quickly enough. If this maximum is one packet the protocol is called
stop-and-wait. Larger windows enable pipelining and improve
performance on long, fast links.
4. The sliding window protocol combines these features and is also used to
support bidirectional data transfer.
Flow Control and Buffering

 For flow control the segments need to be stored.


 Can be achieved in different ways.
 Static and dynamic
(a) Chained fixed-size buffers.
(b) Chained variable-sized buffers.
(c) One large circular buffer per connection.
Flow Control and Buffering (2)

In line 16 above B allocated more buffers but the allocation segment (TPDU) was lost.
To prevent deadlocks like this, each host should periodically send control segments
giving the ack and buffer status on each connection .
Multiplexing

Multiplexing: four distinct transport connections all use the


same network connection (e.g., IP address) to the remote host.
Multiplexing

(a) Upward multiplexing. (b) Downward multiplexing.


inverse multiplexing.
Single process using multiple IP connections..
SCTP (Stream Control Transmission Protocol),
Crash Recovery
a) If hosts and routers are subject to crashes or connections are long-
lived (e.g., large software or media downloads), recovery from these
crashes becomes an issue.
b) If the transport entity is entirely within the hosts, recovery from
network and router crashes is straightforward. The transport entities
expect lost segments all the time and know how to cope with them
by using retransmissions.
c) A more troublesome problem is how to recover from host crashes.

d) Crash recovery is the process by which the database is moved


back to a consistent and usable state. This is done by rolling back
incomplete transactions and completing committed transactions that
were still in memory when the crash occurred
Crash Recovery
Rule of Thumb: ‘‘recovery from a layer N crash can only be done by layer N +
1,’’ and then only if the higher layer retains enough status information to
reconstruct where it was before the problem occurred.

Figure: Different combinations of client and server strategy.


The Internet Transport Protocols: UDP

• Introduction to UDP
• Remote Procedure Call
• The Real-Time Transport Protocol
Introduction to UDP
UDP is a connectionless protocol for the Transport Layer
UDP (User Datagram Protocol) is a shim over IP
Header has ports (TSAPs), length and checksum.

The UDP header.


UDP has an optional checksum for extra reliability.
UDP does NOT do flow control, congestion control, or retransmission based
upon receipt of a bad segment. If any of these services are needed, then the
application will need to do them for itself.
Remote Procedure Call

Steps in making a remote procedure call. The stubs are shaded.


a) Packing the parameters is called marshaling.
The Real-Time Transport Protocol

(a) The position of RTP in the protocol stack. (b) Packet nesting.
The Real-Time Transport Protocol (2)

The RTP header.


P: padding 4 bytes, X: extension header, Cc: contributing sources
M: mark start of video, coding mp3
The Real-Time Transport Protocol (2)
RTCP: Real Time Transport control protocol

1. The first function can be used to provide feedback on delay,


variation in delay or jitter, bandwidth, congestion, and other
network properties to the sources.
Well-known ports used with UDP
The Internet Transport Protocols: TCP
• Introduction to TCP
• The TCP Service Model
• The TCP Protocol
• The TCP Segment Header
• TCP Connection Establishment
• TCP Connection Release
• TCP Connection Management Modeling
• TCP Transmission Policy
• TCP Congestion Control
• TCP Timer Management
• Wireless TCP and UDP
• Transactional TCP
The Internet Transport Protocols: TCP
• The Transmission Control Protocol (TCP) is the Internet’s
most popular transport layer connection-oriented protocol.

• TCP only accepts user data streams from local application


processes.

• All TCP connections are full duplex and Point-to-Point.


The TCP Service Model
TCP provides applications with a reliable byte stream between processes; it is
the workhorse of the Internet
•Port Registry: https://www.ietf.org/assignments/service-names-port-
numbers/service-names-port-numbers.xml
•Popular servers run on well-known ports

Port Protocol Use


21 FTP File transfer
23 Telnet Remote login
25 SMTP E-mail
69 TFTP Trivial File Transfer Protocol
79 Finger Lookup info about a user
80 HTTP World Wide Web
110 POP-3 Remote e-mail access
119 NNTP USENET news

Some assigned ports.


The TCP Service Model
Applications using TCP see only the byte stream [right] and not the segments
[left], which are sent as separate IP packets

Figure: Stream delivery


The TCP Service Model

Figure : Sending and receiving buffers


The TCP Service Model

Figure : TCP segments


The TCP Service Model
TCP Features The bytes of data being transferred in
each connection are numbered by
TCP. The numbering starts with a
randomly generated number.
1. Numbering System
a. Byte Number The value in the sequence number
field of a segment defines the number
b. Sequence Number of the first data byte contained in that
segment.
c. Aknowledgement Number
2. Flow Control The value of the acknowledgment field
in a segment defines the number of the
3. Error Control next byte a party expects to receive.
The acknowledgment number is
cumulative.
4. Congestion Control
The TCP Service Model
The following shows the sequence number for each
segment:
The TCP Service Model (2)

(a) Four 512-byte segments sent as separate IP datagrams.


(b) The 2048 bytes of data delivered to the application in a single
READ CALL.
The TCP Segment Header

TCP Header.
The TCP Segment Header

Table : Description of flags in the control field


The TCP Segment Header (2)

The pseudoheader included in the TCP checksum.


TCP Connection Establishment
TCP Connection

1. Connection Establishment
a. Three-way Handshaking
b. SYN Flooding attack(problem in connection establishment)
2. Data Transfer
a. Pushing Data
b. Urgent Data
3. Connection Termination
a. Three-way Handshaking (Full-close):: Asymmetric Release)
b. Half - close :: Symmetric Release
TCP Connection Establishment

6-31

(a) TCP connection establishment in the normal case.


(b) Call collision.
TCP Connection Management Modeling

The states used in the TCP connection management finite state machine.
TCP Connection Management Modeling (2)
TCP connection
management finite state
machine.
The heavy solid line is
the normal path for a client.
The heavy dashed line is
the normal path for a
server.
The light lines are
unusual events. Each
transition is labeled by the
event causing it and the
action resulting from it,
separated by a slash.
TCP Transmission Policy

Window management in TCP.


TCP Transmission Policy (2)

Silly window syndrome.


Receiver application reads single bytes, so sender always sends one byte
segments
TCP Congestion Control
TCP Congestion Control
TCP Congestion Control (2)

An example of the Internet congestion algorithm.


TCP Timer Management

(a) Probability density of ACK arrival times in the data link layer.
(b) Probability density of ACK arrival times for TCP.
Wireless TCP and UDP

Splitting a TCP connection into two connections.


Transitional TCP

(a) RPC using normal TPC.


(b) RPC using T/TCP.
Performance Issues

• Performance Problems in Computer Networks


• Network Performance Measurement
• System Design for Better Performance
• Fast TPDU Processing
• Protocols for Gigabit Networks
Performance Problems in Computer Networks

The state of transmitting one megabit from San Diego to Boston


(a) At t = 0, (b) After 500 μsec, (c) After 20 msec, (d) after 40 msec.
Network Performance Measurement

The basic loop for improving network performance.


1. Measure relevant network parameters, performance.
2. Try to understand what is going on.
3. Change one parameter.
System Design for Better Performance
Rules:
1. CPU speed is more important than network speed.
2. Reduce packet count to reduce software overhead.
3. Minimize context switches.
4. Minimize copying.
5. You can buy more bandwidth but not lower delay.
6. Avoiding congestion is better than recovering from it.
7. Avoid timeouts.
System Design for Better Performance (2)

Response as a function of load.


System Design for Better Performance (3)

Four context switches to handle one packet


with a user-space network manager.
Fast TPDU Processing

The fast path from sender to receiver is shown with a heavy line.
The processing steps on this path are shaded.
Fast TPDU Processing (2)

(a) TCP header. (b) IP header. In both cases, the shaded fields are taken
from the prototype without change.
Fast TPDU Processing (3)

A timing wheel.
Protocols for Gigabit Networks

Time to transfer and acknowledge a 1-megabit file over a 4000-km line.

You might also like