0% found this document useful (0 votes)
15 views100 pages

Unit IV

The document outlines the syllabus for a Computer Networks course focusing on the Transport Layer, detailing its services, responsibilities, and protocols such as TCP, UDP, and SCTP. It explains key concepts like multiplexing, flow control, congestion control, and the client-server architecture, along with the importance of port numbers and sockets in network communication. The document serves as a comprehensive guide for understanding the functionalities and mechanisms of the Transport Layer in the TCP/IP protocol suite.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views100 pages

Unit IV

The document outlines the syllabus for a Computer Networks course focusing on the Transport Layer, detailing its services, responsibilities, and protocols such as TCP, UDP, and SCTP. It explains key concepts like multiplexing, flow control, congestion control, and the client-server architecture, along with the importance of port numbers and sockets in network communication. The document serves as a comprehensive guide for understanding the functionalities and mechanisms of the Transport Layer in the TCP/IP protocol suite.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 100

Computer Networks (CET2005B)

School of Computer Engineering and Technology (SCET)

1
Syllabus

Transport Layer (9 Hrs)


Services, Multiplexing, demultiplexing. Sockets, UDP,
RTP, TCP: Services, Features, Segment, TCP Connection
4 (Three-Way Handshake), Flow control and buffering,
Silly window syndrome, Congestion Control. Congestion
Control (Leaky Bucket, Token Bucket), Quality of
Service (QoS)

2
Transport Layer: Contents

 Services
 Multiplexing, Demultiplexing.
 Sockets
 UDP (User Datagram Protocol ), RTP (Real-Time Transport
Protocol), TCP (The Transmission Control Protocol): Services,
Features, Segment
 TCP Connection (Three-Way Handshake)
 Flow Control and buffering (Sliding Window)
 Flow and Congestion Control (Leaky Bucket, Token Bucket)
 Quality of Service (QoS)

3
Introduction
 The transport layer in the TCP/IP suite is
located between the application layer
and the network layer.
 It provides services to the application
layer and receives services from the
network layer.
 The transport layer acts as a liaison
between a client program and a server
program, a Process-to-Process
connection.
 The transport layer is the heart of the
TCP/IP protocol suite.

4
Transport Layer Services
At the sender’s side: The transport layer receives data (message) from
the Application layer and then performs Segmentation, divides the actual
message into segments, adds the source and destination’s port numbers
into the header of the segment, and transfers the message to the Network
layer.

At the receiver’s side: The transport layer receives data from the
Network layer, reassembles the segmented data, reads its header,
identifies the port number, and forwards the message to the appropriate
port in the Application layer.
Responsibilities of a Transport Layer

• The Process to Process Delivery


• End-to-End Connection between Hosts
• Multiplexing and Demultiplexing
• Congestion Control
• Data integrity and Error correction
• Reliable delivery
• Flow control
6
Responsibilities of a Transport Layer
The Process to Process Delivery:
Data Link Layer requires the MAC address, Network layer requires the IP
address in a similar way Transport Layer requires a Port number to correctly
deliver the segments of data to the correct process amongst the multiple
processes running on a particular host.
A port number is a 16-bit address used to identify any client-server program
uniquely.

7
Responsibilities of a Transport Layer
End-to-end Connection between Hosts:
The transport layer is also responsible for creating the end-to-end
Connection between hosts for which it mainly uses TCP and UDP.

8
Responsibilities of a Transport Layer
Multiplexing and Demultiplexing:
Multiplexing allows the simultaneous use of different processes over a network that is running
on a host. Data is acquired from several processes from the sender and merged into one packet
along with headers and sent as a single packet. The processes are differentiated by their port
numbers.
Demultiplexing is required at the receiver side when the message is distributed into different
processes. Transport receives the segments of data from the network layer distributes and
delivers it to the appropriate process running on the receiver’s machine.

9
Responsibilities of a Transport Layer
Congestion Control:
Transport layer provides Congestion Control in different ways.
It uses open-loop congestion control to prevent congestion and closed-
loop congestion control to remove the congestion in a network once it
occurred.

Leaky Bucket
Congestion
Control
Technique
10
Responsibilities of a Transport Layer
Data integrity and Error Correction: The transport layer checks for errors in the
messages coming from the application layer by using error detection codes, and
computing checksums.
It uses the ACK and NACK services to inform the sender if the data has arrived or
not and checks for the integrity of data.

11
Responsibilities of a Transport Layer
Reliable delivery:
The transport layer provides reliability services by retransmitting the lost
and damaged packets. Error Control: If an error is introduced inside one
of the routers, then this error will not be caught by
the data link layer. The transport layer performs the
checking for the errors end-to-end to ensure that the
packet has arrived correctly.

Sequence Control: On the receiving end, it ensures


that the various segments of a transmission can be
correctly reassembled.
Duplication Control: The transport layer
Loss Control: The transport layer ensures that all
guarantees that no duplicate data arrive at the
the fragments of a transmission arrive at the
destination. Sequence numbers allow the
destination using the segment numbers given at the
receiver to identify and discard duplicate
sender side
segments.
12
Responsibilities of a Transport Layer

Flow Control:
• The transport layer provides a flow control mechanism between the
adjacent layers of the TCP/IP model.
• TCP also prevents data loss due to a fast sender and slow receiver by
imposing some flow control techniques.
• It uses the method of sliding window protocol which is accomplished by
the receiver by sending a window back to the sender informing the size of
data it can receive.
• Sliding window protocol is byte oriented rather than frame oriented.

13
Transport Primitives
Transport entity -
 The (logical) relationship of the
network, transport, and application
layers

 On the sending side, the transport


layer converts the application-layer
messages it receives from a sending
application process into transport-
layer packets, known as transport-
layer segments in Internet
terminology.
14
Transport Primitives
 a segments.
 a transport-layer header.
 a network-layer packet (a datagram).

15
Transport Primitives
Transport Protocols –
⮚Internet Protocol (IP) provides a packet delivery
service across the internet
⮚IP cannot distinguish between multiple processes
(applications) running on the same computer
⮚Fields in the IP datagram header identify only
computers.
⮚A protocol that allows an application to serve as
an end-point of communication is known as a
transport protocol or an end-to-end protocol.
⮚The TCP/IP protocol suite provides transport
protocols:
1.The User Datagram Protocol (UDP)
2.The Transmission Control Protocol (TCP)
3.Stream Control Transmission Protocol(SCTP) 16
Transport Primitives
Transport Protocols Services –
⮚ Each protocol provides a different type of service and should be used appropriately.
UDP:
⮚ UDP is an unreliable connectionless transport-layer protocol used for its simplicity
and efficiency in applications where error control can be provided by the
application-layer process.
TCP:
⮚ TCP is a reliable connection-oriented protocol that can be used in any application
where reliability is important.
SCTP:
 Stream Control Transmission Protocol is a connection-oriented network protocol to
transmit multiple data streams between endpoints .
17
Key Transport Primitives
1. **Connect**: Establishes a connection (TCP: 'connect()').
2. **Listen**: Server waits for connections (TCP: 'listen()').
3. **Accept**: Server accepts a connection (TCP: 'accept()').
4. **Send/Write**: Sends data (TCP: 'send()', 'write()').
5. **Receive/Read**: Receives data (TCP: 'recv()', 'read()').
6. **Disconnect/Close**: Terminates a connection (TCP:
'close()').

18
19
Client Server Architecture
 There are several ways to achieve Process-to-Process communication, the
most common one is 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.
 Both processes (client and server) have the same name. For example, to get
the day and time from a remote machine, we need a Daytime client process
running on the local host and a Daytime server process running on a
remote machine.
 A remote computer can run several server programs at the same time, just
as local computers can run one or more client programs at the same time.

20
Port Numbers
• A port number is a way to identify a specific process to which an internet or other
network message is to be forwarded when it arrives at a server.
• All network-connected devices come equipped with standardized ports that have
an assigned number.
• These numbers are reserved for certain protocols and their associated function.
• Hypertext Transfer Protocol (HTTP) messages, for example, always go to port 80
-- one of the most commonly used ports.

• An IP address is a logical address used to identify a device on the network. Any


device connected to the internet is assigned a unique IP address for identification.
This identifying information enables devices to communicate over the internet.

• Port numbers are part of the addressing information that helps identify senders
and receivers of information and a particular application on the devices. Port
numbers consist of 16-bit numbers.
21
Port Numbers
 A port number uses 16 bits and so can therefore have a value from 0 to 65535
decimal.
 The lANA (Internet Assigned Number Authority) has divided the port numbers
into three ranges: well known, registered, and dynamic (or private).

 Port numbers 0-1023 – Well known Ports – e.g. Web servers normally use port 80 and
SMTP servers use port 25
 Ports 1024-49151 – Registered Port.
 Ports 49152-65535 – Dynamic Ports – These are used by client programs.
22
Port Numbers
Some commonly used ports and their associated networking protocols:
Ports 20 and 21: FTP is used to transfer files between a client and a server.
Port 22: Secure Shell is one of several tunneling protocols used to build secure network
connections.
Port 25: Simple Mail Transfer Protocol (SMTP) is commonly used for email.
Port 53: Domain name system (DNS) is a critical process that matches human-readable
domain names to machine-readable IP addresses on the modern internet. It helps users
load websites and applications without typing in a long list of IP addresses.
Port 80: HTTP is the protocol that enables the World Wide Web.
Port 123: Network Time Protocol helps computer clocks sync with each other. It's a
vital process in encryption
Port 179: Border Gateway Protocol (BGP) helps establish efficient routes between the
large networks or autonomous systems that make up the internet. These large networks
use BGP to broadcast which IP addresses they control. 23
Some Common Port Numbers

24
Port Numbers

25
Port Numbers (Cntd.)

Hyper Text
Post Office Transfer
Protocol Protocol.

26
Sockets
 A process sends messages into, and receives messages from, the network
through a software interface called a Socket.
 A socket is one endpoint of a two way communication link between two
programs running on the network.
 Figure illustrates socket communication between two processes that
communicate over the Internet.

27
Sockets
• The socket provides bidirectional FIFO Communication facility over the
network
• Socket are generally employed in client server applications.
• The server creates a socket, attaches it to a network port addresses then waits for
the client to contact it.
• The client creates a socket and then attempts to connect to the server socket.
When the connection is established, transfer of data takes place.
• Each socket has a specific address. This address is composed of an IP address
and a port number.

28
Sockets
 A socket is a software concept for
a connection.
 Sockets enable applications to
connect to transport layer protocol
(TCP/IP / UDP / SCTP).
 An application running on a host
creates a socket to connect with an
application on another host.
 Messages pass through this
socket.

29
Sockets (Cntd.)
 Three applications requiring three TCP communication channels:
 Two channels for each of the two web browsers acting as HTTP clients, and
one for the email application acting as an SMTP client.

30
Types of Sockets (Cntd.)
Datagram Sockets:
• Datagram Sockets are connectionless-oriented and unreliable.
• Uses UDP (User Datagram Protocol) protocol.
• They are basically used in audio/video streaming.

Stream Sockets:
• Stream Sockets are connection-oriented and guarantees reliable and in
order data transmission.
• Uses TCP (Transmission Control Protocol) protocol.
• Used in areas where reliability cannot be compromised.

31
Client Server Model Example
Client/Server Model
Sockets as we know are used in bidirectional network
communication and a good example of it is client/server model.

Client: Client is a machine which generates the requests.


Server: Server is a machine which is generates a response to the
corresponding requests.
It is always listening for requests.

Consider an example, a website


• A website is hosted on a machine (server) which listens
continuously for HTTP requests.
• All the webpages are stored in the server.
• Users who log into the website are actually clients which send
HTTP request to access a webpage.
• An webpage is sent as a response to a request.
32
Connectionless and Connection Oriented Protocol
 A transport-layer protocol, like a network-layer protocol, can provide two types of
services: connectionless and connection-oriented.
 The nature of these services at the transport layer, however, is different from the ones
at the network layer.
 At the network layer, a connectionless service may mean different paths for
different datagrams belonging to the same message; connection-oriented means
dedicated path established before communication initiated.
 At the transport layer, we are not concerned about the physical paths of packets
 Connectionless service at the transport layer means independency between
packets
 Connection-oriented service at the transport layer means dependency between
packets
 The connectionless protocol is UDP.
 The connection-oriented protocol is TCP.
33
Connectionless and Connection Oriented Protocol
Connectionless Service: independency between Connection-oriented Service: Dependency between
packets packets

34
Transmission Control Protocol [TCP]
• Transmission Control Protocol (TCP) is a connection-oriented, reliable
protocol.
• Connection-Oriented Service – explicitly defines connection
establishment, data transfer, and connection teardown (Closing/
Releasing) phases.

TCP Applications:
• Useful for applications that require reliable data delivery, and can tolerate
some timing variation
• File transfer and web downloads
• Email
• Instant messaging
35
TCP Services

• Process-to-Process Communication
• Stream oriented
• Full-duplex service
• Connection-oriented service
• Reliability
• Multiplexing

36
TCP Services
Process to process communication – TCP provides a process to process
communication, i.e, the transfer of data that takes place between individual
processes executing on end systems. This is done using socket address

Stream oriented – the data is sent and received as a stream of bytes. TCP
groups a number of bytes together into a segment and adds a header to each
of these segments and then delivers these segments to the network layer.
At the network layer, each of these segments is encapsulated in an IP packet
for transmission. The TCP header has information that is required for
control purposes which will be discussed along with the segment structure.

Full-duplex service –
This means that the communication can take place in both directions at the
same time.
37
TCP Services
Connection-oriented service –
TCP provides a connection-oriented service. It defines 3 different phases:
• Connection establishment
• Data transfer
• Connection termination

Reliability –
TCP is reliable as it uses checksum for error detection, attempts to recover lost or
corrupted packets by re-transmission, acknowledgement policy and timers. It uses features
like byte number and sequence number and acknowledgement number so as to ensure
reliability. Also, it uses congestion control mechanisms.

Multiplexing –
TCP does multiplexing and de-multiplexing at the sender and receiver ends respectively as
a number of logical connections can be established between port numbers over a physical
connection.
38
TCP Services
Byte number, Sequence number and
Acknowledgement number
• All the data bytes that are to be transmitted
are numbered
• Sequence numbers are given to the segments
so as to reassemble the bytes at the receiver
end
• The sequence number of a segment is the
byte number of the first byte that is being
sent.
• The acknowledgement number is the next
byte number that the receiver expects to
receive.
39
TCP Segment format

40
TCP Header
 Source Port (16-bits): It identifies source port of the application process
on the sending device.
 Destination Port (16-bits): It identifies destination port of the application
process on the receiving device.
 Sequence Number (32-bits): Sequence number of data bytes of a segment
in a session.
 Acknowledgement Number (32-bits): When ACK flag is set, this number
contains the next sequence number of the data byte expected and works as
acknowledgement of the previous data received.
 Header Length (HLEN): This is a 4-bit field that indicates the length of
the TCP header. The number stored is multiplied by 4 to get the length in
bytes (e.g. field will hold 5 then length is 5 x 4 = 20)
41
TCP Header
 Window size: This field tells the window size of the sending TCP in bytes.
 Checksum: This field holds the checksum for error control.
 Urgent pointer: This field (valid only if the URG control flag is set) is used
to point to data that is urgently required that needs to reach the receiving
process at the earliest.
 Reserved (3-bits): Reserved for future use and all are set zero by default.
 Control flags:
• URG: Urgent pointer is valid
• ACK: Acknowledgement number is valid( used in case of cumulative acknowledgement)
• PSH: Request for push
• RST: Reset the connection
• SYN: Synchronize sequence numbers
• FIN: Terminate the connection 42
TCP Header
Urgent (URG) –Data inside a segment with URG = 1 flag is forwarded to application
layer immediately even if there are more data to be given to application layer.

Acknowledgement (ACK) –
It is used to acknowledge packets which are successfully received by the host. The flag is
set if the acknowledgement number field contains a valid acknowledgement number.

Push (PSH) – Transport layer by default waits for some time for application layer to
send enough data equal to maximum segment size.
Sender Transport layer sets PSH = 1 and immediately sends the segment to network layer
as soon as it receives signal from application layer. Receiver transport layer, on seeing
PSH = 1 immediately forwards the data to application layer.

43
TCP Header
Reset (RST):
It is used to terminate the connection if the sender feels something is wrong with
the TCP connection or that the conversation should not exist.

Synchronization(SYN): It is used in first step of connection establishment phase.


Only the first packet from sender as well as receiver should have this flag set. This
is used for synchronizing sequence number

Finish (FIN) – It is used to request for connection termination i.e. when there is no
more data from the sender, it requests for connection termination. This is the last
packet sent by sender. It frees the reserved resources and gracefully terminate the
connection.

44
TCP: Connection Establishment
Connection Establishment: Three way Handshaking
 A TCP connection is opened by a three-way handshake to establish a
common view of the sequence numbers.

45
Transmission Control Protocol [TCP] (Cntd.)
1. Connection Establishment: Three way Handshaking
Host 1 chooses a sequence number, x, and
sends a CONNECTION REQUEST segment
containing it to host 2.

Host 2 replies with an ACK segment


acknowledging x and announcing its own
initial sequence number, y.

Finally, host 1 acknowledges host 2’s choice of


an initial sequence number in the first data
segment that it sends.

46
Windows in TCP
Windows in TCP: TCP uses two windows (send window and receive window) for each
direction of data transfer
1. Senders send 2KB of data along with Seq
no.
2. Receiver sends ACK of previous SEQ no
and send remaining window size WIN
(2048)
3. Sender again send 2KB of data to receiver.
4. Now at Receivers side buffer gets full, so he
sends ACK of previous SEQ no and WIN
=0. Sender is in blocked state until some
memory of receiver's buffer is empty.
5. Receivers buffer is always full until it
PUSH the data to application layer
6. This state is called Silly window syndrome
problem

47
Windows in TCP
1. To resolve Silly Window Syndrome
problem, receiver sends half of the
remaining window size
2. As shown in dig. Instead of sending 2KB of
free space receiver sends 1 KB as a window
size
3. So receiver will always have 1Kb of
remaining window size.
4. Application always read the data of 1KB (in
this problem), so receiver will never have
buffer full problem and sender will not be in
block state.
5. This is called as Nagle’s algorithm.

48
Closing / Releasing of TCP Connection

TCP supports two types of connection releases like most


connection-oriented transport protocols:

Graceful connection release –


In the Graceful connection release, the connection is open until
both parties have closed their sides of the connection.

Abrupt connection release –


In an Abrupt connection release, either one TCP entity is forced to
close the connection or one user closes both directions of data
transfer.

49
Closing / Releasing of TCP Connection
Graceful Connection Release :
The common way of terminating a TCP connection is by using the TCP header’s
FIN flag.
1. A sends a FIN packet and waits for a response; it can
release some resources but awaits the response of the
other part (Fin Wait)
2. B receives the FIN packet and must release resources; it
waits for a closing application level (Close Wait)
3. B can now send a FIN to A and then await
its acknowledgement (Last Ack wait).
4. A can now fully close its job, but it must wait for network
collision (Time Wait); it may have to send the final ACK
another time.
5. B eventually receives the final ACK and destroys (kills)
the connection.`
50
Closing / Releasing of TCP Connection

Abrupt connection release : An abrupt connection release is carried out when


an RST segment is sent
An RST segment can be sent for the below reasons:

• When a non-SYN segment is received for a non-existing TCP connection.


• In an open connection, some TCP implementations send an RST segment
when a segment with an invalid header is received which prevents attacks by
closing the corresponding connection.
• When some implementations need to close an existing TCP connection, they
send an RST segment. They will close an existing TCP connection for the
following reasons:
1. Lack of resources to support the connection
2. The remote host is now unreachable and has stopped responding.

51
User Datagram Protocol [UDP]
• User Datagram Protocol (UDP) is a communications protocol for time-sensitive
applications like gaming, playing videos, or Domain Name System (DNS)
lookups.
• UDP results in speedier communication because it does not spend time forming
a firm connection with the destination before transferring the data. Eliminating
this step results in faster data transfer speeds.
The process behind UDP is fairly simple.
• A target computer is identified and the data packets, called “datagrams,” are sent
to it.
• There is nothing in place to indicate the order in which the packets should
arrive.
• There is also no process for checking if the datagrams reached the destination.
• As a result, the data may get delivered, and it may not.
• The order in which it arrives is not controlled, as it is in TCP, so the way the data
appears at the final destination may be glitchy, out of order, or have blank spots.52
User Datagram Protocol [UDP]
• Connectionless Transport Protocol.
• UDP transmits segments consisting of an 8-byte fixed size header followed by the
payload.
• The header is shown below

53
User Datagram Protocol [UDP] (Cntd.)
• Question: The following is the content of a UDP header in hexadecimal format.
CB84000D001C001C
⮚ What is the source port number?
⮚ What is the destination port number?
⮚ What is the total length of the user datagram?
⮚ What is the length of the data?
⮚ Is the packet directed from a client to a server or vice versa?
⮚ What is the client process?
⮚Solution: Try to Solve It…….

54
User Datagram Protocol [UDP]
Solution CB84000D001C001C
⮚ The source port number is the first four hexadecimal digits CB84H, which
means that the source port number is 52100.
⮚ The destination port number is the second four hexadecimal digits 000DH,
which means that the destination port number is 13.
⮚ The third four hexadecimal digits 001CH define the length of the whole UDP
packet as 28 bytes.
⮚ The length of the data is the length of the whole packet minus the length of
the header, or 28 − 8 = 20 bytes.
⮚ Since the destination port number is 13 (well-known port), the packet is from
the client to the server.

55
User Datagram Protocol [UDP]
UDP Services:
⮚ Process to Process communication – using socket address
⮚ Connectionless services
⮚ Flow Control – Not present
⮚ Error Control – Not present
⮚ Checksum – based on pseudo header, UDP header, and data (Can be Optional)
⮚ Congestion Control – Not present
⮚ Encapsulation & Decapsulation
⮚ Queuing
⮚ Multiplexing & Demultiplexing

56
User Datagram Protocol [UDP]
UDP Applications:
⮚ UDP is suitable for a process that requires simple request-response
⮚ communication with little concern for flow and error control.
⮚ UDP is suitable for a process with internal flow- and error-control
⮚ mechanisms. For example, the Trivial File Transfer Protocol (TFTP).
⮚ UDP is a suitable transport protocol for multicasting.
⮚ UDP is used for management processes such as SNMP.
⮚ UDP is used for some route updating protocols such as Routing Information
⮚ Protocol (RIP).
⮚ UDP is normally used for interactive real-time applications that cannot
⮚ tolerate uneven delay between sections of a received message. E.g.
⮚ multimedia applications.
⮚ Client-server RPC is one area in which UDP is widely used.
57
Comparison of TCP and UDP
Basis Transmission Control Protocol (TCP) User Datagram Protocol (UDP)
UDP is the Datagram-oriented
TCP is a connection-oriented protocol.
protocol. This is because
Connection orientation means that the
there is no overhead for opening a
Type of communicating devices should establish a
connection, maintaining a connection,
Service connection before transmitting data and
or terminating a connection. UDP is
should close the connection after
efficient for broadcast and multicast
transmitting the data.
types of network transmission.
TCP is reliable as it guarantees the delivery The delivery of data to the destination
Reliability
of data to the destination router. cannot be guaranteed in UDP.
Error checking TCP provides extensive error-checking
UDP has only the basic error-checking
mechanism mechanisms. It is because it provides flow
mechanism using checksums.
control and acknowledgment of data.
Acknowledgm
An acknowledgment segment is present. No acknowledgment segment.
ent
58
Comparison of TCP and UDP
Basis Transmission Control Protocol(TCP) User Datagram Protocol (UDP)
Sequencing of data is a feature of
There is no sequencing of data in
Transmission Control
Sequence UDP. If the order is required, it has to
Protocol (TCP). this means that packets
be managed by the application layer.
arrive in order at the receiver.
UDP is faster, simpler, and more
Speed TCP is comparatively slower than UDP.
efficient than TCP.
There is no retransmission of lost
Retransmissi Retransmission of lost packets is possible
packets in the User Datagram Protocol
on in TCP, but not in UDP.
(UDP).
Header TCP has a (20-60) bytes variable length UDP has an 8 bytes fixed-length
Length header. header.
Weight TCP is heavy-weight. UDP is lightweight.
Handshaking Uses handshakes such as SYN, ACK, It’s a connectionless protocol i.e. No
Techniques SYN-ACK handshake
59
Comparison of TCP and UDP
Basis Transmission Control Protocol (TCP) User Datagram Protocol (UDP)
Broadcasting TCP doesn’t support Broadcasting. UDP supports Broadcasting.
Broadcasting TCP doesn’t support Broadcasting. UDP supports Broadcasting.
TCP is used by HTTP, HTTPs, FTP, SMTP UDP is used by DNS, DHCP,
Protocols
and Telnet. TFTP, SNMP, RIP, and VoIP.
UDP connection is a message
Stream Type The TCP connection is a byte stream.
stream.
Overhead Low but higher than UDP. Very low.
This protocol is used in situations
This protocol is primarily utilized in
where quick communication is
situations when a safe and trustworthy
necessary but where dependability is
Applications communication procedure is necessary,
not a concern, such as VoIP, game
such as in email, on the web surfing, and
streaming, video, and music
in military services.
streaming, etc.

60
Real-Time Transport Protocol [RTP]
• Real-time Transport Protocol (RTP) is a network standard designed for
transmitting audio or video data that is optimized for consistent delivery
of live data.
• It is used in internet telephony, Voice over IP and video
telecommunication. It can be used for one-on-one calls (unicast) or in
one-to-many conferences (multicast).
• RTP must be used with UDP. It does not have any delivery mechanism
like multicasting or port numbers.
• RTP supports different formats of files like MPEG and MJPEG. It is
very sensitive to packet delays and less sensitive to packet loss.

61
Real-Time Transport Protocol [RTP]
⮚ Multimedia Applications such as Internet radio, Internet telephony,
music-on-demand, video conferencing, video-on-demand, and other
are reinventing more or less the same real-time transport protocol.
⮚ Thus generic real-time transport protocol for multiple applications would
be a good idea. i.e. RTP (Real-time Transport Protocol).
⮚ Aspects of real-time transport:
⮚ Transporting Audio and Video data in packets.
⮚ Processing that takes place, mostly at the receiver, to play out the
audio and video at the right time.

62
Real-Time Transport Protocol [RTP] (Cntd.)

63
Real-Time Transport Protocol [RTP] (Cntd.)
⮚ RTP normally runs in user space over UDP (in the operating system).
⮚ Its works as follows:

Multimedia RTP RTP Through UDP IP


Fed into Multiplexing Ethernet
application library Packets Sockets Packets Packets

Because of this design, it is a little hard to say which layer RTP is in.
⮚ looks like an application protocol – because it runs in user space and is linked to the
application program.
⮚ looks like a transport protocol – because it is a generic, application independent protocol
that just provides transport facilities

64
Real-Time Transport Protocol [RTP] (Cntd.)
Basic function
⮚ Multiplex several real-time data streams onto a single stream of UDP
packets.
⮚ Unicasting or Multicasting can be done.
⮚ There are no special guarantees about delivery, and packets may be
lost, delayed, corrupted, etc.
⮚ The RTP format contains several features to help receivers work with
multimedia information.
• Sequence Numbering
• Encoding for Different profiles such as audio, video etc.
• Time stamping

65
RTP Header

66
RTP Header
Version : This 2-bit field defines version number. The current version is 2
P – The length of this field is 1-bit. If value is 1, then it denotes presence of
padding at end of packet and if value is 0, then there is no padding.
X – The length of this field is also 1-bit. If value of this field is set to 1, then
its indicates an extra extension header between data and basic header and if
value is 0 then, there is no extra extension.
Contributor count – This 4-bit field indicates number of contributors. Here
maximum possible number of contributor is 15 as a 4-bit field can allows
number form 0 to 15.
M – The length of this field is 1-bit and it is used as end marker by
application to indicate end of its data.
67
RTP Header
Payload types –
This field is of length 7-bit to indicate type of payload. We list applications of some
common types of payload.

68
Real-Time Transport Protocol [RTP] (Cntd.)
 Time Stamp –
The length of this field is 32-bit. It is used to find relationship between times
of different RTP packets. The timestamp for first packet is given randomly
and then time stamp for next packets given by sum of previous timestamp
and time taken to produce first byte of current packet.

 Sequence Number –
The length of this field is 16 bits. It is used to give serial numbers to RTP
packets. The sequence number for first packet is given a random number and
then every next packet’s sequence number is incremented by 1. This field
mainly helps in checking lost packets and order mismatch.

69
Real-Time Transport Protocol [RTP] (Cntd.)
• Synchronization Source Identifier –
This is a 32-bit field used to identify and define the source. The value for
this source identifier is a random number that is chosen by source itself.
This mainly helps in solving conflict arises when two sources started with
the same sequencing number.

• Contributor Identifier –
This is also a 32-bit field used for source identification where there is more
than one source present in session. The mixer source use Synchronization
source identifier and other remaining sources (maximum 15) use
Contributor identifier.

70
TCP: Error Control (Cntd.)
TCP is a reliable transport layer protocol. TCP provides reliability using error
control.
Error control includes mechanisms for detecting----
 Corrupted segments.
 Lost segments.
 Out-of-order segments.
 Duplicated segments.
Error detection and correction tools: in TCP is achieved through the use of
three simple tools:
 Checksum.
 Acknowledgment.
 Time-out.
71
TCP: Error Control (Cntd.)
Checksum : Each segment includes a checksum field which is used to check for a
corrupted segment. If the segment is corrupted, it is discarded by the destination
TCP and is considered as lost. TCP uses a 16-bit checksum that is mandatory in
every segment.

Acknowledgment : TCP uses acknowledgments to confirm the receipt of data


segments. Control segments that carry no data but consume a sequence number are
also acknowledged. ACK segments are never acknowledged.

Retransmission : The heart of the error control mechanism is the


retransmission of segments. When a segment is corrupted, lost, or delayed, it is
retransmitted.
In modern implementations, a segment is retransmitted on two occasions:
• When a retransmission timer expires or
• When the sender receives three duplicate ACKs.
72
TCP: Error Control (Cntd.)
• Error Control (Cntd.): Scenarios Normal operation

73
TCP: Error Control (Cntd.)
Retransmission (Cntd.)
Retransmission after
retransmission time-out
(RTO):
• Sending TCP maintains one
retransmission time-out
(RTO) for each connection.
• When the timer matures,
i.e. times out, TCP resends
the segment.
• The value of RTO is
dynamic in TCP and is
updated based on the
round-trip time (RTT) of
segments.

74
TCP: Error Control (Cntd.)
Retransmission (Cntd.)

Retransmission after
retransmission time-out
(RTO):

Lost acknowledgment
corrected by resending
a segment

75
TCP: Error Control (Cntd.)
Retransmission after Three
Duplicate ACK Segments:
• Goal in this retransmission
method is to allowing senders
to retransmit without waiting
for a time out.
• if three duplicate
acknowledgments (i.e., an
original ACK plus three
exactly identical copies) arrive
for a segment, the next
segment is retransmitted
without waiting for the time-
out.
• This feature is called fast
retransmission.
76
TCP: Error Control (Cntd.)
• Error Control (Cntd.): Out of Order segments
⮚ Data may arrive out of order and be temporarily stored by the
receiving TCP, but TCP guarantees that no out-of-order data are
delivered to the process.

77
TCP: Congestion Control
⮚ Congestion control refers to Techniques and Mechanisms
that can either Prevent congestion before it happens or
Remove congestion after it has happened.

Prevention Removal

Prevent congestion before it happens Remove congestion after it has happened.

78
TCP: Congestion Control (Cntd.)
Congestion Control: Open-Loop Congestion Control (Prevention)
• Open loop congestion control policies are applied to prevent congestion
before it happens.
• The congestion control is handled either by the source or the destination.

There is a brief list of policies that can prevent congestion.


1. Retransmission Policy
2. Window Policy
3. Acknowledgement Policy
4. Discarding Policy
5. Admission Policy (first check the resource requirement of a network flow before transmitting it further.)
79
TCP: Congestion Control (Cntd.)
Open-Loop Congestion Control Policies
Retransmission Policy :
If the sender feels that a sent packet is lost or corrupted, the packet needs to be retransmitted.
This transmission may increase the congestion in the network.
To prevent congestion, retransmission timers must be designed to prevent congestion and also able to
optimize efficiency.

Window Policy :
The type of window at the sender’s side may also affect the congestion. Several packets
in the Go-back-n window are re-sent, although some packets may be received
successfully at the receiver side.
This duplication may increase the congestion in the network and make it worse.
Therefore, Selective repeat window should be adopted as it sends the specific packet that
may have been lost.
80
TCP: Congestion Control (Cntd.)
Discarding Policy :
A good discarding policy adopted by the routers is that the routers may prevent congestion and
at the same time partially discard the corrupted or less sensitive packages and also be able to
maintain the quality of a message.

In case of audio file transmission, routers can discard less sensitive packets to prevent
congestion and also maintain the quality of the audio file.

Acknowledgment Policy :
Since acknowledgements are also the part of the load in the network, the acknowledgment
policy imposed by the receiver may also affect congestion. Several approaches can be used to
prevent congestion related to acknowledgment.
The receiver should send acknowledgement for N packets rather than sending
acknowledgement for a single packet. The receiver should send an acknowledgment only if it
has to send a packet or a timer expires.
81
TCP: Congestion Control (Cntd.)

Admission Policy :
In admission policy a mechanism should be used to prevent
congestion. Switches in a flow should first check the resource
requirement of a network flow before transmitting it further.
If there is a chance of a congestion or there is a congestion in
the network, router should deny establishing a virtual network
connection to prevent further congestion.

82
Transmission Control Protocol [TCP] (Cntd.)
Congestion Control: Closed-Loop Congestion Control (Removal)

⮚ Closed-loop congestion control mechanisms try to alleviate


(lighten) congestion after it happens.
Several mechanisms have been used by different protocols. We
describe a few of them here.
1. Backpressure.
2. Choke Packet.
3. Implicit Signaling.
4. Explicit Signaling.

83
Transmission Control Protocol [TCP] (Cntd.)
• Congestion Control: Closed-Loop Congestion Control (Removal) (Cntd.)
Backpressure :
• Backpressure is a technique in which a congested node stops receiving packets from upstream
node.
• This may cause the upstream node or nodes to become congested and reject receiving data from
above nodes.
• Backpressure is a node-to-node congestion control technique that propagate in the opposite
direction of data flow.
• The backpressure technique can be applied only to virtual circuit where each node has
information of its above upstream node.

84
Transmission Control Protocol [TCP] (Cntd.)
• Congestion Control: Closed-Loop Congestion Control (Removal) (Cntd.)
Choke Packet Technique :
 Choke packet technique is applicable to both virtual networks as well as datagram
subnets.
 A choke packet is a packet sent by a node to the source to inform it of congestion.
 Each router monitors its resources and the utilization at each of its output lines.
 Whenever the resource utilization exceeds the threshold value which is set by the
administrator, the router directly sends a choke packet to the source giving it a feedback
to reduce the traffic.
 The intermediate nodes through which the packets has traveled are not warned about
congestion.

85
Transmission Control Protocol [TCP] (Cntd.)
• Congestion Control: Closed-Loop Congestion Control (Removal) (Cntd.)

3. Implicit Signaling :
In implicit signaling, there is no communication between the congested nodes
and the source.
The source guesses that there is congestion in a network.
For example when sender sends several packets and there is no
acknowledgment for a while, one assumption is that there is a congestion.

86
Transmission Control Protocol [TCP] (Cntd.)
• Congestion Control: Closed-Loop Congestion Control (Removal) (Cntd.)
4. Explicit Signaling :
In explicit signaling, if a node experiences congestion it can explicitly sends a packet
to the source or destination to inform about congestion.
The difference between choke packet and explicit signaling is that the signal is included
in the packets that carry data rather than creating a different packet as in case of choke
packet technique.

Explicit signaling can occur in either forward or backward direction.


1. Forward Signaling : In forward signaling, a signal is sent in the direction of the
congestion. The destination is warned about congestion. The receiver in this
case adopt policies to prevent further congestion.
2. Backward Signaling : In backward signaling, a signal is sent in the opposite
direction of the congestion. The source is warned about congestion and it needs
to slow down.
87
Transmission Control Protocol [TCP] (Cntd.)
Regulating the Sending Rate

Figure: (a) A fast network feeding a low-capacity receiver. (b) A slow network feeding a high-capacity receiver.

88
Transmission Control Protocol [TCP] (Cntd.)
Regulating the Sending Rate:

There are 2 types of Regulating the Sending Rate algorithms:

1. Leaky Bucket

2. Token Bucket

• A leaky bucket algorithm shapes bursty traffic into


fixed-rate traffic by averaging the data rate.
• It may drop the packets if the bucket is full.

89
Leaky Bucket
 Assume that the network has committed a bandwidth of 3 Mbps for a host.
 The use of the leaky bucket shapes the input traffic to make it conform to this commitment.
 In Figure the host sends a burst of data at a rate of 12 Mbps for 2 s, for a total of 24 Mbits of
data.
 The host is silent for 5 s and then sends data at a rate of 2 Mbps for 3 s, for a total of 6 Mbits
of data.
 In all, the host has sent 30 Mbits of data in 10 s.
 The leaky bucket smooths the traffic by sending out data at a rate of 3 Mbps during the same 10
s.
Without the leaky bucket, the beginning burst may have hurt the network by consuming more
bandwidth than is set aside for this host.

Figure: Leaky bucket.


90
Token Bucket
Regulating the Sending Rate (Cntd.): Token Bucket
⮚ The token bucket allows bursty traffic at a regulated maximum rate.
• Step 1 − In regular intervals tokens
are thrown into the bucket f.
• Step 2 − The bucket has a maximum
capacity c.
• Step 3 − If the packet is ready, then
a token is removed from the bucket,
and the packet is sent.
• Step 4 − Suppose, if there is no
token in the bucket, the packet
Figure: Token bucket. cannot be sent.
91
Token Bucket
• Regulating the Sending Rate (Cntd.): Token Bucket

In figure (a) the bucket holds two


tokens, and three packets are
waiting to be sent out of the
interface.

In Figure (b) two packets have


been sent out by consuming two
tokens, and 1 packet is still left.
Figure: Token bucket.

92
Transmission Control Protocol [TCP] (Cntd.)

93
Quality of Service [QoS]
⮚ Another way of looking at the transport layer is to regard its
primary function as Enhancing the QoS (Quality of Service)
provided by the network layer.
⮚ If the network service is poor, the transport layer has to bridge
the gap between what the application users want and what the
network layer provides.
⮚ The transport service may allow the user to specify preferred,
acceptable, and minimum values for various service parameters
at the time a connection is setup.

94
Quality of Service [QoS] (Cntd.)
QoS Parameters:
⮚ The connection establishment delay: The time difference between the
instant at which a transport connection is requested and the instant at which it
is confirmed is called as connection establishment delay
⮚ The connection establishment failure probability: It is the probability that
connection is not established even after the maximum connection
establishment delay. This problem will occur due to network congestion, lack
of table space or some other problems.
⮚ Throughput: This parameter describes the average data transfer rate at the
network transport level.
⮚ Transit delay: The delay refers to the time required to transmit a packet or a group of
packets from the transmit end to the receive end.
95
Quality of Service [QoS] (Cntd.)
QoS Parameters
 Residual error ratio: Residual error ratio (RER) is the ratio of total
incorrect, lost and duplicated Data units to the total Data units transferred
between users during a period of time.
 Protection: Protection is the extent to which a provider attempts to prevent
unauthorized monitoring or manipulation of user-originated information.
 Priority: Quality of Service (QoS) prioritizes network traffic and manages
available bandwidth so that the most important traffic goes first.
 Resilience: Resilience is meaningful in connection mode only, and
represents the probability of either: Data Link Service provider-initiated
disconnects or Data Link Service provider-initiated resets during a time
interval of 10,000 seconds on a connection.

96
NPTEL Video Lecture Links on Transport Layer
1. https://www.youtube.com/watch?v=8-3CSAkscYU
2. https://www.youtube.com/watch?v=fBPDLGwfSUM
3. https://www.youtube.com/watch?v=c8Wv3b7f9XY
4. https://www.youtube.com/watch?v=qclg6FY-FGM
5. https://www.youtube.com/watch?v=VUdfS70puWI
6. https://www.youtube.com/watch?v=bKHRbqwkMkg
7. https://www.youtube.com/watch?v=b-nCA0tZU-0
8. https://www.youtube.com/watch?v=EqzDTO9tdqs
9. https://www.youtube.com/watch?v=5ex1s4lURto
10. https://www.youtube.com/watch?v=xS202cWCc2Q
11. https://www.youtube.com/watch?v=8NxJGHXDOGc
12. https://www.youtube.com/watch?v=SHO9eeWxPxY
13. https://www.youtube.com/watch?v=f1y25BfOH9I
14. https://www.youtube.com/watch?v=x7obJLN7FcQ
15. https://www.youtube.com/watch?v=JExfKvUgrtI

97
NPTEL Web Links on Transport Layer
1. https://nptel.ac.in/courses/106106091/36
2. https://nptel.ac.in/courses/106106091/37
3. https://nptel.ac.in/courses/106106091/38
4. https://nptel.ac.in/courses/106106091/39
5. https://nptel.ac.in/courses/106105080/32

98
References
Text Books:
1. Behrouz A. Forouzan, ‘Data Communications and Networking’, 5th Edition, McGraw-Hill Publishing Company, ISBN 978-
0-07-337622-6
2. Tanenbaum A. S., ‘Computer Networks’, Pearson Education , 5th Edition, ISBN-978-0-13-212695-3
Reference Books:
3. James F. Kurose and Keith W Ross ‘Computer Networking, A Top-Down Approach’, 5th Edition, Pearson Education, ISBN-
978-81-317-9054-0
4. W. Richard Stevens, Unix Network Programming, The Sockets Networking API, Vol 1, 3rd Edition, PHI Learning Pvt. Ltd.
Supplementary Reading:
5. William Stallings, ‘Data and Computer Communications’, 6th Edition, Prentice Hall of India Pvt.
Web Resources:
6. https://nptel.ac.in/courses/106/105/106105080/
7. https://nptel.ac.in/courses/106/106/106106091/
Web links:
8. https://nptel.ac.in/courses/106/105/106105081/
9. https://nptel.ac.in/courses/106/105/106105183/
10. https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-829-computer-networks-fall-2002/index.htm
MOOCs:
11. https://www.coursera.org/learn/computer-networking
12. https://www.edx.org/course/introduction-to-networking?index=product&queryID=0befdc538866babf2facfdc2dce06204&posi
tion=1

99
Thank You

Any Questions

100

You might also like