Transcript Chapter06

Chapter 6
The Transport Layer
The Transport Service
•
•
•
•
Services provided to the Upper Layers.
Quality of Service
Transport service primitives
Services provided to upper layer
– Provide efficient reliable and cost effective services
to processes in the application layer
– Transport entity does the work (could exist in OS, in
a user process or a library pkg.) next slide
– Connection oriented and connectionless (but this is
also in the network layer). Why do we need transport
layer at all? See two slides from this one.
The Transport Service
• Services provided to upper layer
TPDU = Transport protocol data unit
The Transport Service
• Why two distinct layers?
– Network layer is part of communication subnet and is
run by the carrier (for WAN’s).
– What if network layer is unreliable, loses packets or
crashes?
– Users have no control over subnet and cannot poor
service problems
– Need to put a layer on top of network layer that
improves the quality of service.
– Lost pkts + bad data can be detected and
compensated for by the trans. Layer.
The Transport Service
• Why two distinct layers?
– App programs can be written using standard
primitives and have them work on a wide variety of
networks - ignoring subnet interfaces and poor
transmission
– Isolates upper layers from imperfections of subnet
– Bottom 4 layers are transport service provider
– Upper layers are called transport service user
The Transport Service
• Quality of Service
– Bridges gap between a possibly unreliable network
layer and what the transport users want
– Connection establishment delay, connection
establishment failure probability, throughput, transit
delay, residual error ratio, protection, priority,
resilience
– Connection establishment delay amt. Of time
elapsing between a transport connection being
requested and its confirmation being recd.
– Connection establishment failure probability is the
prob. Of a conn. Not being estd. Withing the max.
establishment delay time.
The Transport Service
• Quality of Service
– Throughput parameter measures the number of bytes
of user data transferred per second, measured over
some time interval.
– Transit delay measures the time between a mess.
Being sent by the transport user on the source
machine and its being recd. By the transport user on
the destination machine.
– Residual error ratio measures the number of lost of
garbled messages as a fraction of total sent
– Protection transport user can specify protection
against wiretappers.
The Transport Service
• Quality of Service
– Throughput parameter measures the number of bytes
of user data transferred per second, measured over
some time interval.
– Transit delay measures the time between a mess.
Being sent by the transport user on the source
machine and its being recd. By the transport user on
the destination machine.
– Residual error ratio measures the number of lost of
garbled messages as a fraction of total sent
– Protection transport user can specify protection
against wiretappers.
The Transport Service
• Quality of Service
– Priority indicate some connections are more impt
than others - in case of congestion make sure that the
higher-priority connections get serviced before the
low priority ones.
– Resilience probability of the transport layer itself
spontaneously terminating a connection due to
internal problems or congestion.
–
The Transport Service
• Transport service primitives
– TSP allows users of the transport layer to access
transport service.
Primitive
TPDU sent
Meaning
LISTEN
(none)
Block until some process tries to connect
1
CONNECT CONNECTION REQ. Actively attempt to establish a connection
2
SEND
DATA
Send information
3
RECEIVE
(none)
Block until a DATA TPDU arrives
4
DISCONNECT DISCONNECTION REQ.
This side wants to release connection
5
1
Server executes a LISTEN. Server blocks until client shows up.
2
Client executes CONNECT. Transport layer blocks client, sends pkt. to server.
CONN. REQ. TPDU sent to server. Transport entity checks if server is blocked
on a LISTEN. If so, sends CONN. ACCEPTED TPDU to client. On recpt. by
client, client is unblocked.
3,4
Can use SEND/RECEIVE now. Blocking is used.
5
Asymmetric DISCONNECT - either party can issue a DISCONN. primitive.
Symmetric - one side does DISC means no more data from that side, but it
is willing to recv. data from other side. Connection released when both do DISC.
Bezerkely sockets
• Sockets
Primitive
Meaning
S
E SOCKET
R
BIND
V
E LISTEN
R ACCEPT
Create a new communication end point. Alloc. table space. Success returns a file descriptor (FD).
Attach a local address to a socket. After address binding, remote clients can connect.
Announce readiness to accept conns; give queue size. Nonblocking.
Block caller until conn attempt comes. Spawn socket+new FD. Listen on orig. sock.
C CONNECT
L
I
SEND
E
N RECEIVE
T CLOSE
1
Actively attempt to establish conn (1). Blocks caller. On completion, unblocked.
Send some data over the connection
Receive data from the connection
Release the connection. It is symmetric.
Client must first use SOCKET primitive.
Establishing a connection
• Three way handshake (Normal Operation)
– Host 1 chooses seq number = x and sends
CONNECTION REQUEST (CR) to host 2.
– Host 2 replies with CONNECTION ACCEPTED
(ACK) acknowledging x and announcing its own seq
=y
– Host 1 acks host 2 choice of initial seq number (y) in
the first set of data that it sends.
• Three way handshake (Old Duplicate)
– First TPDU is a delayed CR (arrives at host 2
without 1 knowing)
– 2 responds by sending an ACK
Releasing a connection
• Releasing a connection
– Two ways - asymmetric and symmetric
– Asymmetric - hang up the phone. Symmetric each
party hangs up - each connection is unidirectional.
Connection is established. H1 sends 1 TPDU. It sends
another, but H2 sends a disconnect request (DR) and
connection is lost and data remain in limbo.
NORMAL
RESPONSE
LOST
FINAL
ACK
LOST
RESPONSE
LOST &
SUBSEQ.
DR’s LOST
Releasing a connection
• Read paragraphs 1, 2, 3 on page 502 on your
own.
• Ignore 6.2.4, 6.2.5, 6.2.6,
• Ignore section 6.3
TCP and UDP
• TCP (Transmission Control Protocol)
– Connection oriented (UDP - User Datagram Protocol
is connectionless).
– Designed to dynamically adapt to properties of the
internetwork since different topologies, bandwidths,
delays & packet sizes exist on the internetwork.
– Need to distinguish between TCP transport entity
(softw.) & TCP proto. (rules). Clear from the context.
• TCP Service Model
– Service is obtained by having sender and receiver
create sockets. Sockets have IP address of host as
well as a 16 bit number (port) associated with it.
TCP and UDP
• TCP Service Model
– Service is obtained by having sender and receiver
create sockets. Sockets have IP address of host as
well as a 16 bit number (port) associated with it.
– More than one conn. can terminate in same socket.
– Port numbers < 1024 are well known ports - e.g.,
FTP is port 21, Telnet 23.
– TCP is full dup. & point-to-point (no broad or multi)
– Byte stream not message stream. e.g., user writes
4x512 bytes to TCP stream. Receiver may get it as
2048 bytes, 2x1024 bytes, 4x512 bytes.
TCP Segment Header
TCP Segment Header
•
•
•
•
Fixed format 20byte header.
Source port/dest. Port (1024 and above)
Seq number
Acknowledgement # is not the last byte correctly
received but the next byte expected
• TCP Header length - how many 32 bit words are
contained in the TCP header.