0% found this document useful (0 votes)
16 views83 pages

Transport and Application Layer Overview

This document outlines the syllabus and course outcomes for a Computer Networks module focusing on the Transport and Application Layer. It covers key protocols such as TCP and UDP, their functionalities, and transport layer services including error control, flow control, and connection management. Additionally, it discusses the importance of these protocols in ensuring reliable communication over networks.

Uploaded by

u2303028
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)
16 views83 pages

Transport and Application Layer Overview

This document outlines the syllabus and course outcomes for a Computer Networks module focusing on the Transport and Application Layer. It covers key protocols such as TCP and UDP, their functionalities, and transport layer services including error control, flow control, and connection management. Additionally, it discusses the importance of these protocols in ensuring reliable communication over networks.

Uploaded by

u2303028
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

101003/CS500B

Computer Networks
Module 5
Transport and Application Layer
Syllabus
● Transport service – Services provided to the upper layers - Transport service
primitives
● User Datagram Protocol (UDP)
● Transmission Control Protocol (TCP) – Overview of TCP - TCP segment header -
Connection establishment & release –Connection management modeling -TCP
retransmission policy -TCP congestion control.
● Application Layer –File Transfer Protocol (FTP) - Domain Name System (DNS)
● Electronic mail - Multipurpose Internet Mail Extension (MIME)
● Simple Network Management Protocol (SNMP)
● World Wide Web(WWW) – Architectural overview.
Course Outcomes

● CO 1: Explain the features of computer networks, protocols, and network design


models
● CO 2: Describe the fundamental characteristics of the physical layer and identify
the usage in network communication
● CO 3: Explain the design issues of data link layer, link layer protocols, bridges and
switches
● CO 4: Select appropriate routing algorithms, congestion control techniques, and
Quality of Service requirements for a network
● CO 5: Illustrate the functions and protocols of the network layer, transport layer,
and application layer in inter-networking
Transport Layer - Introduction
● The transport layer is an end-to-end layer – this means that nodes within the subnet do not
participate in transport layer protocols – only the end hosts are involved.
● TL protocols send data as segments.
● 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 that is
independent of the physical networks currently in use.
● The Transport Service: Transport layer provides services to the upper application layer.
Transport Layer - Introduction
● Ultimate goal of transport layer is to provide efficient, reliable and cost-effective services to its
users which are processes running on the application layer.

● For this we have a transport entity. It is located in the OS kernel or is a separate user process
or on the NIC.
Need for 2 Distinct Layers
● Transport service runs on user’s machine, while network service runs on routers.

● Users have less control over network layer, so use a top layer and improve quality of service.

● The presence of transport layer provides reliability as lost packets can be managed and
compensated.

● Application programmers can write code according to a standard set of primitives and make
them work on any kind of network.

● Bottom 4 layers- transport service provider.

● Top 3 layers- transport service user.


Transport Layer Services
1. Process-to-Process Communication
2. Addressing: Port Numbers
3. Encapsulation and Decapsulation
4. Multiplexing and Demultiplexing
5. Flow Control
6. Error Control
7. Congestion Control
8. Connectionless and Connection-Oriented Services
Process to Process Communication
● Process is an application layer entity – running program.

● Transport layer is responsible for delivering the message to the appropriate process.
Addressing Port Numbers
• Process-to-process communication usually follows the client-server paradigm.
• Hosts are identified by their IP addresses.
• Ports are identified by port numbers.
• In TCP/IP the port numbers are identifiers between 0 – 65,535.
IP Addresses vs Port Numbers
ICANN Ranges
● Well known ports. Eg: DNS-53, HTTP-80 etc.

● Registered ports. Eg: used by companies.

● Dynamic ports. Eg: assigned to normal users.


Socket Address in Transport Layer
● 16 bit port numbers identify the
particular process in a node.

● IP address identify the particular node in a network.


● Socket Address – IP + Port Number
Encapsulation and Decapsulation

TCP Application-layer data


header

User datagram or Segment or Packet


Encapsulation and Decapsulation
● The term SEGMENT refers to messages sent from
transport entity to transport entity.
● TCP, UDP and other Internet protocols use this term.
○ Some older protocols used TPDU (Transport
Protocol Data Unit).
● The segments (exchanged by TL) are contained in
packets (exchanged by NL).
● In turn, these packets are contained in frames
(exchanged by the DLL).
● When a frame arrives, the data link layer processes the
frame header and, if the destination address matches
for local delivery, passes the contents of the frame
payload field up to the network entity.
● The network entity similarly processes the packet
header and then passes the contents of the packet
payload up to the transport entity.
Multiplexing and Demultiplexing
Flow Control
● When the producer produces items faster than what can be consumed by the consumer, the
consumer will have to drop some packets

● Use buffers.
Error Control
• Detect and discard corrupted packets

• Keep track of lost and discarded packets and resend them

• Recognize duplicate packets and discard them

• Buffer out-of-order packets until the missing packets arrive

▪ Sequence numbers
▪ Acknowledgements
▪ Time-out
Flow Control and Error Control
Congestion Control
● Congestion occurs if the load on the network (the number of packets sent to the network) is
greater than the capacity of the network (the number of packets a network can handle)

● Congestion control refers to the mechanisms and techniques to control the congestion and
keep the load below the capacity

● Open-loop congestion control


○ Policies are applied to prevent congestion before it happens

● Closed-loop congestion control


○ Try to alleviate congestion after it happens
Open Loop Congestion Control
● Retransmission Policy

○ Retransmission policy and the retransmission timers must be designed to optimize


efficiency and to prevent congestion

● Window Policy

○ Type of window (Selective repeat / Go-Back-N)

● Acknowledgement Policy

○ If the receiver does not acknowledge every packet it receives, it may slow down the
sender and help prevent congestion
Connectionless Service
● The source process (application program) divides its message into chunks of data

● Chunks are delivered to the connectionless transport protocol one by one

● The transport layer treats each chunk as a single unit without any relation between the chunks

● No dependency between the packets at the transport layer

● The packets may arrive out of order at the destination and will be delivered out of order to the
server process
Connectionless Service
Connection Oriented Service

● Connection established
● Data transferred
● Connection teared down
Transport Service Primitives
● Five primitives.

● Consider an application with a server and a number of remote clients.

● To start with, the server executes a LISTEN primitive, by calling a library procedure that makes
a system call that blocks the server until a client turns up.

● When a client wants to talk to the server, it executes a CONNECT primitive.


○ The transport entity carries out this primitive by blocking the caller and sending a
packet to the server.
○ Encapsulated in the payload of this packet is a transport layer message for the server’s
transport entity.
Transport Service Primitives
● The client’s CONNECT call causes a CONNECTION REQUEST segment to be sent to the server.

● When it arrives, the transport entity checks to see that the server is blocked on a LISTEN (ie., is
interested in handling requests).

● If so, it then unblocks the server and sends a CONNECTION ACCEPTED segment back to the
client.

● When this segment arrives, the client is unblocked and the connection is established.

● Data can now be exchanged using the SEND and RECEIVE primitives.

● When a connection is no longer needed, it must be released to free up table space within the
two transport entities.
Transport Service Primitives
● Berkeley Sockets:
○ Another set of transport primitives, the
socket primitives used for TCP.
○ Sockets were first released as part of the
Berkeley UNIX 4.2BSD software distribution
in 1983.
○ They quickly became popular.
○ The primitives are now widely used for
Internet programming
Transport Layer Protocols
● The Internet has two main protocols in the transport layer,

● A connectionless protocol – UDP


○ User Datagram Protocol

● A connection-oriented protocol – TCP


○ Transmission Control Protocol
UDP
● User Datagram Protocol.

● UDP is a connectionless unreliable protocol in transport layer.

● Provides process-to-process communication using port numbers.

● Does not provide flow control, congestion control and does not use acknowledgements.

● Error control provided to some extent.

● If UDP detects an error in a received packet, it silently drops it.


Why UDP?
● Simple protocol.

● Minimum overhead.

● A process can use UDP to send a small message without giving importance to reliability.

● Sending small messages using UDP requires only less interaction between sender and receiver
than using TCP.
User Datagram
● UDP packets are called user datagram.

● It has a fixed size header of 8 bytes.


Header Fields

● Source port number- used by process running on source host.

● Destination port number- used by process running on destination host.

● Total length- defines the total length of the user datagram header plus data.

● Checksum- used to detect errors over the entire user datagram.


UDP Services

1. Process-to-process Communication

• Done using sockets – combination


of IP addresses & port numbers
UDP Services

2. Connectionless Service
• User datagram sent by UDP should be an independent datagram.
• User datagrams are not numbered.
• No connection establishment and no connection termination.
• Each request must be small enough to fit into one user datagram.
• Only processes sending short messages, messages less than 65,507 bytes (65,535 minus 8 bytes
for the UDP header and minus 20 bytes for the IP header) can use UDP.
UDP Services

3. No Flow Control

• Here no window mechanisms.

• Receiver may overflow with incoming packets.

4. No Congestion Control

• UDP assumes that packets sent are small and sporadic and won’t create any congestion.

5. Error Control – only through checksum

• Sender does not know if a message has been lost or duplicated.

• When the receiver detects an error through the checksum, the user datagram is silently discarded.
Error Control

● To calculate the checksum a


pseudoheader is prepended to actual
header.

● Calculate checksum on data, header &


pseudoheader and insert.

● The sender of a UDP packet can choose


not to calculate the checksum. Then
insert all 0s.
Checksum Calculation of a UDP Datagram
UDP Services
6. Encapsulation and Decapsulation
UDP Services
7. Queuing
UDP Services
8. Multiplexing and Demultiplexing
Uses of UDP
● Widely used in Client Server Remote Procedure Calls.

● DNS application uses UDP


o A client needs to send a short request to a server and to receive a quick response from
it.

o The request and response can each fit in one user datagram.

● Video streaming uses UDP.

○ If the transport layer resending a corrupted or lost frame, the synchronizing of the whole
transmission may be lost.

○ If UDP we can ignore the corrupted or lost packet and deliver the rest to the application
program - that part of the screen is blank for a very short period of the time.
UDP – Not used
● SMTP application used in electronic mail, cannot use the services of UDP because a user can
send a long e-mail message, which may include multimedia (images, audio, or video).

● FTP applications cannot use UDP, because reliability is needed. It is undesirable that a part of
the downloaded file goes missing or corrupted.

● Applications of UDP
○ Suitable for multicasting applications.
○ Used for management processes such as SNMP.
○ Used for route updating protocols like RIP.
○ Used for real time applications.
○ Used in applications with internal flow and error control mechanisms like TFTP.
TCP
● Transmission Control
Protocol.

● Connection oriented
reliable protocol of
transport layer.

● Ensures stream delivery


service.

● Provides all most all


transport layer services.
TCP Stream Delivery Service
● UDP had messages with pre-defined boundaries.

● TCP is a stream oriented protocol.

● TCP allows the sending process to deliver data as a stream of bytes and allows the receiving
process to obtain data as a stream of bytes.
TCP Stream Delivery Service
● UDP had messages with pre-defined boundaries.

● TCP is a stream oriented protocol.

● TCP allows the sending process to deliver data as a stream of bytes and allows the receiving
process to obtain data as a stream of bytes.
TCP Sending and Receiving Buffers

● Since the sending and receiving process may not operate at the same rate, buffers are used
for storage.
TCP Segments

● TCP groups bytes together into packets called segments.

● Segments are delivered to the IP layer for transmission.


TCP Stream Delivery Service
● Full Duplex Communication
● Segments move in both directions.

● Each TCP endpoint then has its own sending and receiving buffer.

● Multiplexing and Demultiplexing


● Sender performs multiplexing and receiver performs demultiplexing.

● Connection-Oriented Service
● TCPs at the sender and the receiver establishes a virtual connection between them
before sending the data and terminates the connection after sending the data.

● Reliable Service
● Acknowledgements used to ensure safe arrival of data.
TCP Features

● Numbering system

○ Byte number

○ Sequence Number

○ Acknowledgement Number
TCP Features
● Byte number
○ TCP numbers all data bytes (octets) that are transmitted in a connection.

○ The numbering does not necessarily start from 0

○ Numbering is independent in each direction.

○ TCP chooses an arbitrary number between 0 and 232 − 1 as the number of the first
byte.
TCP Features
● Sequence Number
○ TCP assigns a sequence number to each segment.

○ The sequence number for each segment is the number of the first byte of data carried
in that segment.
TCP Features
● Acknowledgment number

● Acknowledgment number is used by a party to confirm the bytes it has received.

● The acknowledgment number defines the number of the next byte that the party expects to
receive.

● The acknowledgment number is cumulative.

● If a party uses 5,641 as an acknowledgment number, it has received all bytes from the
beginning up to 5,640.
TCP Features
● Flow Control
○ The sending TCP controls how much data can be accepted and the receiving TCP
controls how much data can to be sent by the sending TCP.

● Error Control
○ A segment is considered as the unit of data for error detection.

● Congestion Control
○ The amount of data sent by a sender is also determined by the level of congestion in
the network.
Segment Format

● A packet in TCP is
called a segment.

● Consists of header and


data.
Fields in the Segment Header
● Source port number
○ 16-bit field that defines the port number of the host that is sending the segment.

● Destination port number


○ 16-bit field that defines the port number of the host that is receiving the segment.

● Sequence number
○ 32-bit field defines the number assigned to the first byte of data contained in this
segment.
○ During connection establishment each party uses a random number generator to
create an initial sequence number (ISN).
○ The ISN is usually different in each direction.
Fields in the Segment Header
• Acknowledgement number
o 32-bit field defines the byte number that the receiver of the segment is expecting to
receive from the other party.
o If the receiver has successfully received byte number x, it returns x + 1 as the
acknowledgment number .
o Acknowledgment and data can be piggybacked together.

• Header length
o 4-bit field indicates the number of 4-byte words in the TCP header.
o The length of the header can be between 20 and 60 bytes.

• Reserved
o Reserved for future use.
Fields in the Segment Header
• Flags
o URG- it is set to 1 if urgent pointer is in use.
o ACK- it is set to 1 to indicate that the segment contains an acknowledgement.
o PSH- it is set to 1 to indicate pushed data.
o RST- it is set to 1 to indicate a connection is being reset, rejected or refused.
o SYN- it is set to 1 to indicate that a new connection is to be established.
o FIN- it is set to 1 to indicate that a connection is been released.
Fields in the Segment Header
● Urgent Data

○ Application programs may need to send urgent data.

○ The sending application program tells the sending TCP that the piece of data is urgent.

○ The sending TCP creates a segment with the URG bit set.

○ It inserts the urgent data at the beginning of the segment.

○ The rest of the segment can contain normal data from the buffer.

○ The urgent pointer field in the header defines the end of the urgent data.
Fields in the Segment Header
● Pushing Data

● The application program at the sender can request a push operation.

● The sending TCP must not wait for the window to be filled.

● It must create a segment and send it immediately.

● The sending TCP must also set push bit (PSH) .

● Helps the receiving TCP know that the segment includes data that
must be delivered to the receiving application program as soon as possible.
Fields in the Segment Header
● Window size
○ Defines the window size of the sending TCP in bytes.
○ The length of this field is 16 bits, so the maximum size of the window is 65,535 bytes.
○ This value is referred to as the receiving window and is determined by the receiver.

● Urgent pointer
○ 16-bit field, which is valid only if the urgent flag is set. It is used when the segment
contains urgent data.
○ It defines a value that must be added to the sequence number to obtain the number of
the last urgent byte in the data section of the segment.

● Checksum
○ Calculation is same as that in UDP.

● Options
○ There can be up to 40 bytes of optional information.
Pseudo Header
● The TCP pseudo header is added to the beginning of the TCP segment only during the
checksum calculation and is not sent as part of the TCP segment.
Encapsulation
Phases in a TCP Connection
● TCP is a connection oriented protocol.

● It establishes a virtual path between the source and the destination.

● All the segments are sent along this virtual path.

● Transmission is done in three phases:


○ Connection Establishment
○ Data Transfer
○ Connection Termination

● Connection Establishment:
○ TCP transmits data in full-duplex mode.
○ Each party must initialize communication and get approval from the other party before
data is transferred.
○ Connection establishment in TCP is called three-way handshaking.
Connection Establishment – 3-way
Handshaking
Data Transfer – 3-way Handshaking
Connection Termination – 3-way Handshaking

Any of the two parties


can close a connection

Three-way handshaking

Both ends agree and


stop sending data.
Applications
● Bootstrap Protocol
● Dynamic Host Configuration Protocol (DHCP)
● Domain Name System (DNS)
● E-mail
● File Transfer Protocol (FTP)
● IP filtering and network address translation
● Secure Shell (SSH) applications such as PuTTY
● Remote Desktop (RDP) applications such as Microsoft Remote Desktop Client
● Secure File Transfer Protocol (SFTP)
● Secure Copy Protocol (SCP) applications such as WinSCP
TCP vs UDP Communication
Connectionless vs Connection Oriented / UDP vs TCP

● Connectionless: no connection is established ● Connection-oriented: makes a connection with the


between two ends. TL at the destination first before delivering the
● Eg. UDP packets.
○ After data transfer, the connection is
● Treats each segment as an independent packet terminated.
and delivers it to the TL at the destination. ● Eg. TCP, SCTP
● No order kept - Not numbered; they may be ● Creates a relationship between the segments using
delayed or lost or may arrive out of sequence. sequence numbers – no out of sequence delivery.
● Take different paths to destination. ● Delivers messages in the same order they are sent.
● Simple but Unreliable. ● Takes same path to destination.
● There is no acknowledgment. ● Reliable but Complex.
● No flow control. ● Acknowledgment system for error control.
● No guarantee on delivery. ● Sliding windows for flow control.
● Faster service - does not demand flow and error ● Guaranteed delivery.
control. ● Slower service due to connection establishment,
● Used for short messages. flow control and error control.
● Used for large messages.
Flow Control
● It balances the rate at which the producer produces the data with the rate at which a
consumer consumes data.

● Flow control is achieved by adjusting the window sizes of the sender and the receiver.
TCP Transmission Policy
Opening and Closing Windows

Receive
Window
• Closes
• When more bytes
arrive from the sender
• Opens
• When more bytes are
pulled by the process
Opening and Closing Windows

Send
Window
• Closes
• When a new ACK
allows it to do so
• Opens
• Receives window size
(rwnd) advertised by
the receiver
Silly Window Syndrome
● TCP sends data in very small segments in some cases. (tinygrams)
○ The sending application program creates data slowly or the receiving application program
consumes data slowly, or both.

● Segments containing only 1 byte of data.


○ 41-byte datagram (20 bytes of TCP header and 20 bytes of IP header) transfers only 1 byte
of user data.

● Syndrome created by the sender


○ Sending TCP may be serving an application program that creates data slowly, 1 byte at
a time.
○ The application program writes 1 byte at a time into the buffer of the sending TCP.
○ The sending TCP may create segments containing 1 byte of data.
○ Solution is to prevent the sending TCP from sending the data byte by byte and force it to
wait and collect data to send in a larger block.
Silly Window Syndrome
● Nagles’s Algorithm

1. The sending TCP sends the first piece of data it receives from the sending application
program even if it is only 1 byte.

2. After sending the first segment, the sending TCP accumulates data in the output buffer and
waits until either the receiving TCP sends an ACK or until enough data has accumulated to fill
a maximum-size segment, it then sends the segment.

3. Step 2 is repeated for the rest of the transmission. Segment 3 is sent immediately if an
acknowledgment is received for segment 2, or if enough data have accumulated to fill a
maximum-size segment.
Silly Window Syndrome
● Syndrome created by the receiver
○ Receiving application can receive data only 1 byte at a time.
○ Sending application sends kilobytes of data and the buffer at the receiver will be full.
○ Receiver advertises a window size of zero.
○ The receiving application reads the first byte of data from the input buffer of the receiving TCP.
○ Now there is 1 byte of space in the incoming buffer and the receiving TCP announces a window
size of 1 byte.
○ Sender sends 1 byte of data.

● Clark’s Solution
○ Send an ACK as soon as the data arrives.
○ But announce a window size of zero until either there is enough space to accommodate a
segment of maximum size or until at least half of the receive buffer is empty.

● Delayed Acknowledgment
○ The receiver waits until there is a decent amount of space in its incoming buffer before
acknowledging the arrived segments.
Error Control
● Error control includes mechanisms for:
■ Detecting and resending corrupted segments
■ Resending lost segments
■ Storing out-of order segments until missing segments arrive
■ Detecting and discarding duplicated segments

● Error control in TCP is achieved through the use of three tools:


■ Checksum
■ Acknowledgment
■ Time-out
Congestion Control
● Sender’s window size is determined by:
○ The receiver-advertised window size (rwnd)
○ The congestion window size (cwnd)

Actual window size =minimum (rwnd, cwnd)

● Congestion Policy

● TCP’s policy for handling congestion is based on three phases


○ Slow start – exponential increase
○ Congestion avoidance – additive increase
○ Congestion detection – multiplicative decrease
Slow start – Exponential Increase

● Size of cwnd starts with 1.

● Size increases by 1 each time


an ACK is received.

● When the size of window in


bytes reaches the threshold
(ssthresh), slow start stops
and the next phase starts.
Congestion Avoidance – Additive Increase

• When the size of the cwnd reaches


ssthresh the slow start phase stops
and the additive phase begins.

• Each time the whole “window” of


segments is acknowledged (RTT),
the size of the cwnd is increased
by one
Congestion Detection – Multiplicative Decrease
● If a congestion occurs, the cwnd size must be decreased.

● A sender can guess that congestion has occurred when there is a need to retransmit a segment.

● Retransmission can occur in one of two cases:


○ When the RTO timer times out
○ When three duplicate ACKs are received

● Size of the threshold is dropped to half.

● TCP Reacts strongly to time-outs


○ If a time-out occurs, there is a stronger possibility of congestion.
○ It sets the value of the threshold to half of the current window size.
○ It reduces cwnd back to one segment.
○ It starts the slow start phase again.
Congestion Detection – Multiplicative Decrease
● TCP Reacts weakly to Three- Acks
○ If three duplicate ACKs are received, a segment may have been dropped but some segments
after that have arrived safely – possibility of congestion is less than that of time-ou.

○ It sets the value of the threshold to half of the current window size.

○ It sets cwnd to the value of the threshold.

○ It starts the congestion avoidance phase.


TCP Congestion Policy
Congestion Example

You might also like