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

Chapter 7

The transport layer builds on the network layer to provide data transport between processes on different machines. It provides efficient, reliable, and cost-effective data transmission. The transport layer code runs on users' machines while network layer code runs mostly on routers. Transport protocols implement connection establishment, flow control, multiplexing, and crash recovery to provide reliable data delivery.

Uploaded by

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

Chapter 7

The transport layer builds on the network layer to provide data transport between processes on different machines. It provides efficient, reliable, and cost-effective data transmission. The transport layer code runs on users' machines while network layer code runs mostly on routers. Transport protocols implement connection establishment, flow control, multiplexing, and crash recovery to provide reliable data delivery.

Uploaded by

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

Chapter-7

The Transport Layer


Introduction Transport layer

◉ 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
◉ It provides efficient, reliable, and cost-effective data
transmission service
◉ The software and/or hardware within the transport layer that
does the work is called the transport entity

2
3
4
Introduction Transport layer

◉ The obvious question is this: if the transport layer service is so


similar to the network layer service, why are there two distinct
layers?
◉ The transport code runs entirely on the users’ machines, but the
network layer mostly runs on the routers
◉ What if it frequently loses packets?
◉ What happens if routers crash from time to time?
◉ The users have no real control over the network layer

5
Transport Layer
◉ Transport protocol similar to data link protocols
◉ Both do error control and flow control
◉ However, significant differences exist

6
Introduction Transport layer

7
Elements of Transport Protocols

◉ Addressing
◉ Connection establishment
◉ Connection refuse
◉ Flow control and buffers
◉ Multiplexing
◉ Crash recovery

8
Addressing (The process to Process Delivery)

◉ Specify which host process to connect


◉ TSAP: Transport Service Access Point. In TCP, UDP, called ports
◉ Analogy: NSAP. Example: IP address
◉ Client or server app attaches to TSAP
◉ Connections run through NSAP
◉ TSAP to distinguish endpoints sharing NSAP
◉ The destination port number is needed for delivery; the source port number is
needed for the reply

9
10
Addressing (The process to Process Delivery)

◉ In the Internet model, the port numbers are 16-bit integers between 0 and
65,535
◉ The client program defines itself with a port number, chosen randomly by the
transport layer software running on the client host

11
12
Connection Establishment

❑ Issues:
◉ lose, delay, corrupt, duplicate packets
◉ Protocols must work correct all cases
◉ To simplify problem, restrict packet lifetime
❑ restricted network design: prevent looping
❑ hop counter in each packet: -1 at each hop
❑ timestamp in each packet: clock must be synced

13
Connection Establishment

◉ Using a 3-way hand shake, a


connection can be established
◉ Procedure:
1. H1 sends Connection request (CR)
choses initial s# x
2. H2 replies, ACKs x, announce own
s# y
3. H1 replies, ACKs y, with 1st data
segment

14
Connection Establishment

◉ Abnormal situations Delayed


duplicate CR
1. H2 sends ACK to H1
2. H1 rejects
3. H2 knows it was tricked

15
Connection Establishment

◉ Worst case Delay Duplicate CR, old


ACK floating
1. H2 gets delayed CR, replies
2. H1 rejects
3. H2 gets old DATA, discards(z
received instead of y)

16
Connection Release

❑ Asymmetric release
◉ the way telephone works
◉ 1 party hangs up, call broken abrupt;
may cause data loss
◉ better protocol needed

17
Connection Release

❑ symmetric release
◉ Normal release sequence
1. H1 send DR, start timer
2. H2 responds with DR
3. when H1 recvDR, release
4. when H2 recvACK, release

18
Final ACK lost: Host 2 times out Lost DR: H1 starts over
19
Extreme: Many lost DRs both release after N
20
FLOW CONTROL AND BUFFERING

◉ Flow control is done by having a sliding window on each connection to


keep a fast transmitter from over running a slow receiver
◉ Buffering must be done by the sender, if the network service is
unreliable
◉ The sender buffers all the TPDUs sent to the receiver
◉ The buffer size varies for different TPDUs.
◉ They are: a) Chained Fixed-size Buffers b) Chained Variable-size
Buffers c) One large Circular Buffer per Connection

21
FLOW CONTROL AND BUFFERING

◉ Chained Fixed-size Buffers: If most TPDUs are nearly the same size, the
buffers are organized as a pool of identical size buffers, with one TPDU per
buffer.

22
FLOW CONTROL AND BUFFERING

❑ Chained Variable-size Buffers:


◉ If there is wide variation in TPDU size, from a few characters typed at a
terminal to thousands of characters from file transfers, some problems may
occur
◉ If the buffer size is chosen equal to the largest possible TPDU, space will be
wasted whenever a short TPDU arrives.
◉ If the buffer size is chosen less than the maximum TPDU size, multiple
buffers will be needed for long TPDUs.
◉ To overcome these problems, we employ variable-size buffers.

23
FLOW CONTROL AND BUFFERING

❑ One large Circular Buffer per Connection:


◉ A single large circular buffer per connection is dedicated when all
connections are heavily loaded.

24
Multiplexing and Demultiplexing

◉ The addressing mechanism allows multiplexing and demultiplexing by the


transport layer
◉ At the sender site, there may be several processes that need to send packets.
However, there is only one transport layer protocol at any time
◉ This is a many-to-one relationship and requires multiplexing.
◉ The protocol accepts messages from different processes, differentiated by
their assigned port numbers.
◉ After adding the header, the transport layer passes the packet to the network
layer.

25
Multiplexing and Demultiplexing

◉ Demultiplexing
◉ At the receiver site, the relationship is one-to-many and requires
demultiplexing.
◉ The transport layer receives datagrams from the network layer
◉ After error checking and dropping of the header, the transport
layer delivers each message to the appropriate process based on
the port number.

26
27
28
Crash Recovery

◉ If hosts and routers are subject to crashes and connections are long-
lived (e.g., large software or media downloads), recovery from these
crashes becomes an issue
◉ A more troublesome problem is how to recover from host crashes than
router crash
◉ Ex: if server crashed
◉ the server might send a broadcast segment to all other hosts, announcing
that it has just crashed and requesting that its clients inform it of the
status of all open connections

29
Crash Recovery

◉ Each client can be in one of two states:


◉ One segment outstanding, S1, or
◉ No segments outstanding, S0.
◉ If a crash occurs after the acknowledgement has been sent but before
the write has been fully completed
◉ The client will therefore not retransmit, (incorrectly) thinking that the
segment has arrived, missing segment

30
Crash Recovery

◉ write has been done but the crash occurs before the acknowledgement
can be sent.
◉ The client will be in state S1 and thus retransmit, leading to an
undetected duplicate segment in the output stream to the server
application process

31
Classification of port numbers

◉ The well-known ports: are used with those protocols that


serve common applications and services such as HTTP (port
no 80), FTP (port 21) , SMTP (port 25)
◉ assigned and controlled by IANA (Internet Assigned Numbers
Authority)

32
Classification of port numbers

◉ Registered port
◉ The range of registered port is 1024 to 49151. The registered ports
are used for the user processes.
◉ These processes are individual applications rather than the common
applications that have a well-known port.
◉ Dynamic ports
◉ These port numbers are assigned to the client application
dynamically when a client creates a connection.

33
User datagram protocol (UDP)

34
User datagram protocol (UDP)

◉ It is simplest Transport Layer communication protocol involves minimum


amount of communication mechanism
◉ It is an unreliable transport protocol but it uses IP services which
provides best effort delivery mechanism.
◉ It is a connectionless protocol as it does not require any virtual circuit to
transfer the data

35
Features of UDP protocol
❑ Connectionless
◉ It does not create a virtual path to transfer the data.
◉ It does not use the virtual path, so packets are sent in different paths between
the sender and the receiver
◉ Which leads to the loss of packets or received out of order
❑ Ordered delivery of data is not guaranteed.
◉ The datagrams are sent in some order will be received in the same order is
not guaranteed as the datagrams are not numbered
❑ Ports : uses different port numbers so that the data can be sent to the correct
destination

36
Features of UDP protocol

❑ Segments are handled independently


◉ each segment takes different path to reach the destination
❑ Faster transmission
◉ enables faster transmission as it is a connectionless protocol
◉ chance that the individual packet is lost, which affects the transmission
quality
❑ Acknowledgment mechanism
◉ there is no handshaking between the UDP sender and UDP receive

37
Features of UDP protocol
❑ Stateless
◉ the sender does not get the acknowledgement for the packet which has
been sent.
❑ Why do we require the UDP protocol?
◉ where the acknowledgement packets share significant amount of
bandwidth along with the actual data
◉ EX: in case of video streaming, thousands of packets are forwarded
◉ Acknowledging all the packets may contain huge amount of bandwidth
wastage.
◉ Loss of few packets in video and voice traffic goes unnoticed.

38
UDP Header Format

39
UDP Header Format
◉ Source port number: It is 16-bit information that identifies which
port is going t send the packet.
◉ port number can range from 0 to 65,535
◉ Destination port number: It identifies which port is going to accept
the information.
◉ It is 16-bit information which is used to identify application-level
service on the destination machine.
◉ If the destination host is the server (a client sending a request), the
port number, in most cases, is a well-known port number.

40
UDP Header Format

◉ If the destination host is the client (a server sending a response),


the port number, in most cases, is an ephemeral port number
◉ Length: This is a 16-bit field that defines the total length of the
user datagram, header plus data.
◉ The 16 bits can define a total length of 0 to 65,535 bytes
◉ The minimum value would be 8-byte as the size of the header is
8 bytes
◉ UDP length = IP length - IP header's length

41
UDP Header Format

◉ Checksum: This field is used to detect errors over the entire


user datagram (header plus data)
◉ It is an optional field, which means that it depends upon the
application, whether it wants to write the checksum or not.
◉ If it does not want to write the checksum, then all the 16 bits are
zero

42
UDP Operation
❑ Connectionless Services:
◉ Each user datagram sent by UDP is an independent datagram
◉ The user datagrams are not numbered
◉ there is no connection establishment and no connection termination
◉ This means that each user datagram can travel on a different path.
❑ Flow and Error Control
◉ There is no flow control and hence
◉ no window mechanism. The receiver may overflow with incoming messages

43
UDP Operation

◉ There is no error control mechanism in UDP except for the checksum


◉ When the receiver detects an error through the checksum, the user
datagram is silently discarded
❑ Encapsulation and Decapsulation
◉ To send a message from one process to another, the UDP protocol
encapsulates and decapsulates messages in an IP datagram.

44
UDP Operation

◉ Queuing:
◉ when a process starts, it requests a port number from the operating system
◉ Some implementations create both an incoming and an outgoing queue
associated with each process Other implementations create only an incoming
queue

45
UDP Operation

◉ The queues function as long as the process is running. When the process
terminates, the queues are destroyed.
◉ UDP removes the messages one by one and, after adding the UDP header,
delivers them to IP.
◉ An outgoing queue can overflow. If this happens, the operating system can
ask the client process to wait before sending any more messages.
◉ When a message arrives for a client, UDP checks to see if an incoming
queue has been created for the port number specified in the destination port
number field of the user datagram.

46
UDP Operation

◉ If there is no such queue, UDP discards the user datagram and asks
◉ the ICMP protocol to send a port unreachable message to the server.

47

You might also like