2. TRANSPORT LAYER
Transport layer provides logical communication between application
process running on different host.
Application processes use the logical communication provided by the
transport layer to send messages to each other, free of the worry
about details of the physical infrastructure used to carry these
messages.
3. SERVICES PROVIDED TO UPPER
LAYERGoal of the transport layer is to efficient, reliable and cost effective service
to application layer.
To provide the service, transport layer uses service provided by network
layer.
Hardware and software within the transport layer that provides service is
called transport layer entity.
Transport layer provides two types service to application layer.
Connection oriented service
Connectionless service
4. Quality of Service
It can be said that primary function of transport layer is, enhancing the QoS
provided by network layer.
Transport layer allows user to specify some minimum, acceptable and desired
value for quality of service parameters at the time of connection set up.
list of the quality of parameters are given here.
The process of negotiating QoS parameter while
Connection establishment is called option negotiation.
Connection Establishment Delay
Connection Establishment Fail
Probability
Throughput
Transit Delay
Residual error date
Protection
Priority
Resilience
5. Transport Service Primitives
Transport service primitives allows transport user like application programs to
access transport service.
Difference between network service and transport service.
1. network service is used only by transport layer, while transport service is
used by number of application programs.
2. network layer service model services offered by real network, real network
can lost the packet, so network layer services are not 100% reliable.
Transport layer services are reliable, it provides reliable service using
unreliable network.
The primitives for a simple transport service.
6. Transport Service Primitives
Listen: executed by server. It means server is ready to accept
connection. It blocks the process of server until connection request
comes.
Connect: executed by client to request the connection. It sends
connection req. TPDU(transport protocol data unit) (packet) to server.
If server is able to handle connection then it sends Connection
accepted TPDU.
Send: executed to send data to other end.
Receive: when ever client or server is waiting for data, It executes
Receive primitive. This is also blocking primitive.
Disconnect: to disconnect connection. Two variants of disconnect.
1. Asymmetric: either side issues disconnect, connection will be
released.
2. Symmetric: both the side need to separately execute disconnect.
7. Transport Service Primitives
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.
11. CONNECTION ESTABLISHMENT
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.
12. CONNECTION RELEASE
Connection at transport can be released in two way.
1. asymmetric: if one of host terminates connection, then in both the
direction, data communication will be terminated.
2. symmetric: if one of the host disconnects connection, then it can
not send the data but it can receive it.
17. FLOW CONTROL & BUFFERING
Transport layer manages end to end to flow. If the receiver is not able to
cope with the flow of data, then data flow should be control from sender
side, that part is done on Transport layer.
Data link layer is also doing flow control, but it controls flow of data
between adjacent nodes in path from source to destination.
Reasons of packet loss at receiver is slow processing speed or
insufficient buffer to store the data.
Buffer are allocated at sender and receiver side. If the network service is
reliable, so every send TPDU sent will be delivered to receiver and will be
buffered and processes at receiver, so no need to keep buffer at sender.
But if network service is unreliable and receiver may not able to handle
every incoming TPDU then sender should also keep a buffer, where copy
of TPDU resides until it’s ACK comes.
18. FLOW CONTROL & BUFFERING
Buffers can be allocate in fixed size when connection sets up or
buffer can be varied dynamically according to free memory. First
case is called static buffer allocation.
(a) Chained fixed-size buffers. (b) Chained variable-sized buffers. (c) One large circular buffer per connection.
19. FLOW CONTROL & BUFFERING
Dynamic Buffer Allocation: as connection are opened and closed,
memory available changes, so sender and receiver dynamically adjust
buffer allocations.
In dynamic buffer allocation, initially sender will request certain
number of buffers based on perceive need. receiver will grant as
many buffers as it can.Sender Receiver
<Req. 8 buffers>
<Buff Alloc. 4>
<Seq.:0,
data=m0>
< Seq.:1,
data=m1>
< Seq.:2, data=m2
> <Ack:2, Buf:2>
<Seq.:3,
data=m3><Seq.:4,
data=m4>
21. CRASH RECOVERY
Hosts and routers are subject to crash.
router crash is easier to handle since transport entities are alive at the host,
routers are only intermediate nodes which forwards packet, they do not have
transport layer entity.
How to recover from host crashes?
One client(host) is sending a file to server(receiver host). Transport layer at
server simply passes TPDU to transport layer. While transmission was on going,
server crashes.
Server crashes and comes up -> table initiated, does not know where it was?
Server sends a broadcast TPDU to all host, announcing that it had just crashed
and requesting that its clients inform it about status of all open connection.
Each client can be in one of two states:
S0: no outstanding TPDU
S1: one TPDU outstanding
22. CRASH RECOVERY
Now it seems that if TPDU is outstanding, client should transmit it, but there are
can be different hidden situations.
1. if server has first sent ACK and before it can send TPDU to next layer, server
crashes. In this case, client will get ACK so it will not retransmit, and TPDU is
lost by server.
2. if server first sends packet to next layer, then it crashes before it can send
ACK. In this case though server has already received TPDU, client thinks TPDU is
lost and it will retransmit.
Server(Receiving host) can be programmed in two ways, 1. ACK first 2. write
first
Three events are possible at server, sending ACK(A), sending packet to next
layer(W), crashing (C).
Three event can occur in six different case: AC(W) AWC C(AW), C(WA) WAC
WC(A)
Client(sending host) can be programmed in four ways, 1. always retransmit last
TPDU, 2. never retransmit last TPDU, 3. retransmit only in S0, 4. retransmit only
24. UDP
User datagram protocol(UDP) is used to send and receive data without
establishing connection.
UDP packets is consist of 8 byte header followed by data.
UDP length includes 8byte header and data, size of whole segment.
UDP checksum is optional, stored as 0 if not computed.
The UDP header.
25. UDP
UDP does not do flow control, error control and retransmission if
packet gets lost.
Area where UDP is useful is client server application. Client sends
short request to server and gets short reply back.
Application that uses UDP this way is DNS.
If a host needs IP address of www.abc.com, it will send UDP packet to
server, server will reply with UDP packet that contains IP address of
site.
26. TCP
Transmission Control Protocol (TCP) was designed to provide reliable
end to end stream over unreliable network.
TCP service is obtain by creating a socket at both client and server
side. Each socket has socket address that consist of IP address and
port number.
Before sending data, connection must be established between
sending and receiving machine.
One socket can be used to establish many connection, many sender
can connect with same receiver socket. TCP connections are identified
by pair of sockets at both the end.
TCP connection are full duplex and point to point. TCP does not
support multicast and broadcast.
TCP connection is byte stream, not a message stream.
27. TCP
Sending and receiving TCP entities exchange data in form of segment.
TCP segment consist of 20 byte header plus optional part followed by data.
When sender transmits a segment, it also starts timer. When segment arrives
at destination, it sends acknowledgment. Acknowledgment contains equal to
sequence number of next data.
If timer for segment expires and acknowledgment does not reach to sender,
sender infers that packet is not delivered to receiver and it retransmits the
segment.
30. TCP HEADER
Options available with TCP
1. NAK(negative acknowledgment): host can send negative
acknowledgment, it specifies sequence number of data not yet
received.
2. timestamp: time stamp of the event when packet is send/received,
this option is used to calculate RTT(round trip time at transport layer)
3. TCP payload: host can specify maximum TCP payload(data in TCP
packet) size it is willing to accept.