KEMBAR78
Transport layer protocols : TCP and UDP | PPTX
Transport-Layer Protocols
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
USER DATAGRAM PROTOCOL
• The User Datagram Protocol (UDP) is a connectionless,
unreliable transport protocol.
• It does not add anything to the services of IP except for
providing process-to-process communication instead of host-to-
host communication.
• UDP is powerless
• UDP packets, called user datagrams,
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Why would a process want to use it?
• UDP is a very simple protocol using a minimum of overhead.
• If a process wants to send a small message and does not care
much about reliability, it can use UDP.
• Sending a small message using UDP takes much less
interaction between the sender and receiver than using TCP.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
User Datagram
• Use fixed-size header of 8 bytes made of four fields, each of 2 bytes
(16 bits).
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
The following is the content of a UDP header in
hexadecimal format.
CB84000D001C001C
a. What is the source port number?
b. What is the destination port number?
c. What is the total length of the user datagram?
d. What is the length of the data?
e. Is the packet directed from a client to a server or vice versa?
f. What is the client process?
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Solution
a. The source port number is the first four hexadecimal digits (CB84)16, which means
that the source port number is 52100.
b. The destination port number is the second four hexadecimal digits (000D)16, which
means that the destination port number is 13.
c. The third four hexadecimal digits (001C)16 define the length of the whole UDP
packet as 28 bytes.
d. The length of the data is the length of the whole packet minus the length of the
header, or 28 − 8 = 20 bytes.
e. Since the destination port number is 13 (well-known port), the packet is from the
client to the server.
f. The client process is the Daytime.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Hexadecimal Decimal
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
A 10
B 11
C 12
D 13
E 14
F 15
Hex to Decimal Formula
C = 12
B = 11
8 = 8
4 = 4
(CB84)16 = (12 x 163 + 11 × 162 + 8× 161 + 4 ×
160 )
= (52100)10
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
UDP Services
• UDP provides process-to-process communication using socket
addresses, a combination of IP addresses and port numbers
• UDP provides a connectionless service
• UDP is a very simple protocol. There is no flow control
• There is no error control mechanism in UDP except for the checksum
• UDP is used for interactive real-time transfer of audio and video.
• UDP protocol encapsulates and decapsulates messages.
• UDP, queues are associated with ports
• UDP multiplexes and demultiplexes.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
UDP Applications
• UDP is suitable for a process that requires simple request-response
communication with little concern for flow and error control. It is not usually
used for a process such as FTP that needs to send bulk data
• UDP is suitable for a process with internal flow- and error-control
mechanisms.
• For example, the Trivial File Transfer Protocol (TFTP) process includes flow
and error control. It can easily use UDP.
• UDP is a suitable transport protocol for multicasting. Multicasting capability
is embedded in the UDP software but not in the TCP software.
• 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
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
TRANSMISSION CONTROL PROTOCOL
• It is a connection-oriented, reliable protocol.
• TCP explicitly defines connection establishment, data transfer, and
connection teardown phases to provide a connection-oriented
service. TCP uses a combination of
• GBN and SR protocols to provide reliability
• TCP uses checksum (for error detection), retransmission of lost or
corrupted packets, cumulative and selective acknowledgments, and
timers.
• TCP is the most common transport-layer protocol in the Internet
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
TRANSMISSION CONTROL PROTOCOL
• TCP provides Full Duplex service, i.e., the data flow in both the
directions at the same time.
• To achieve Full Duplex service, each TCP should have sending and
receiving buffers so that the segments can flow in both the directions.
• Establish a connection between two TCPs.
• Data is exchanged in both the directions.
• The Connection is terminated.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
TCP Services
• TCP provides process-to-process communication using port numbers
• It 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
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Segments
• TCP groups a number of bytes together into a packet called a segment.
• TCP adds a header to each segment (for control purposes) and delivers
the segment to the network layer for transmission.
• The segments are encapsulated in an IP datagram and transmitted.
• segments are not necessarily all the same size
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
TCP Services
• TCP performs multiplexing at the sender and demultiplexing at the
receiver
• TCP is a reliable transport protocol. It uses an acknowledgment
mechanism to check the safe and sound arrival of data.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
TCP Features
• Numbering System
• TCP numbers all data bytes (octets) that are transmitted in a connection.
Numbering is independent in each direction.
• Acknowledgment Number
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
total six types of flags in control field:
•URG: indicates that the data in a segment is urgent.
•ACK: it validates the acknowledgement number.
•PSH: used to inform the sender that higher throughput is needed so if possible,
data must be pushed with higher throughput.
•RST: used to reset the TCP connection when there is any confusion occurs in
the sequence numbers.
•SYN: used to synchronize the sequence numbers in three types of segments:
connection request, connection confirmation ( with the ACK bit set ), and
confirmation acknowledgement.
•FIN: used to inform the receiving TCP module that the sender has finished sending
data. It is used in connection termination in three types of segments: termination
request, termination confirmation, and acknowledgement of termination confirmation.
• Window Size: The window is a 16-bit field that defines the size of the window.
• Checksum: The checksum is a 16-bit field used in error detection.
• Urgent pointer: is set to 1, then this 16-bit field is an offset from the sequence
number indicating that it is a last urgent data byte.
• Options and padding: convey the additional information to the receiver.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
A TCP Connection
Connection Establishment /three-way handshaking
The client sends the
first segment, SYN
segment
The server sends the
second segment, a
SYN + ACK segment
The client sends the
third segment. just
an ACK segment
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Data
Transfer
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Connection
Termination
The FIN segment
consumes one
sequence number if it
does not carry data.
Three-Way
Handshaking
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College
Basis for
Comparison
TCP UDP
Definition TCP establishes a virtual circuit
before transmitting the data.
UDP transmits the data directly
to the destination computer
without verifying whether the
receiver is ready to receive or
not.
Connection Type It is a Connection-Oriented
protocol
It is a Connectionless protocol
Speed slow high
Reliability It is a reliable protocol. It is an unreliable protocol.
Header size 20 bytes 8 bytes
acknowledgement It waits for the
acknowledgement of data and
has the ability to resend the lost
packets.
It neither takes the
acknowledgement, nor it
retransmits the damaged frame.
Dr.T.Abirami, Associate Professor, Department of IT , Kongu
Engineering College

Transport layer protocols : TCP and UDP

  • 1.
    Transport-Layer Protocols Dr.T.Abirami, AssociateProfessor, Department of IT , Kongu Engineering College
  • 2.
    USER DATAGRAM PROTOCOL •The User Datagram Protocol (UDP) is a connectionless, unreliable transport protocol. • It does not add anything to the services of IP except for providing process-to-process communication instead of host-to- host communication. • UDP is powerless • UDP packets, called user datagrams, Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 3.
    Why would aprocess want to use it? • UDP is a very simple protocol using a minimum of overhead. • If a process wants to send a small message and does not care much about reliability, it can use UDP. • Sending a small message using UDP takes much less interaction between the sender and receiver than using TCP. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 4.
    User Datagram • Usefixed-size header of 8 bytes made of four fields, each of 2 bytes (16 bits). Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 5.
    The following isthe content of a UDP header in hexadecimal format. CB84000D001C001C a. What is the source port number? b. What is the destination port number? c. What is the total length of the user datagram? d. What is the length of the data? e. Is the packet directed from a client to a server or vice versa? f. What is the client process? Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 6.
    Solution a. The sourceport number is the first four hexadecimal digits (CB84)16, which means that the source port number is 52100. b. The destination port number is the second four hexadecimal digits (000D)16, which means that the destination port number is 13. c. The third four hexadecimal digits (001C)16 define the length of the whole UDP packet as 28 bytes. d. The length of the data is the length of the whole packet minus the length of the header, or 28 − 8 = 20 bytes. e. Since the destination port number is 13 (well-known port), the packet is from the client to the server. f. The client process is the Daytime. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 7.
    Hexadecimal Decimal 0 0 11 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 A 10 B 11 C 12 D 13 E 14 F 15 Hex to Decimal Formula C = 12 B = 11 8 = 8 4 = 4 (CB84)16 = (12 x 163 + 11 × 162 + 8× 161 + 4 × 160 ) = (52100)10 Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 8.
    Dr.T.Abirami, Associate Professor,Department of IT , Kongu Engineering College
  • 9.
    UDP Services • UDPprovides process-to-process communication using socket addresses, a combination of IP addresses and port numbers • UDP provides a connectionless service • UDP is a very simple protocol. There is no flow control • There is no error control mechanism in UDP except for the checksum • UDP is used for interactive real-time transfer of audio and video. • UDP protocol encapsulates and decapsulates messages. • UDP, queues are associated with ports • UDP multiplexes and demultiplexes. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 10.
    UDP Applications • UDPis suitable for a process that requires simple request-response communication with little concern for flow and error control. It is not usually used for a process such as FTP that needs to send bulk data • UDP is suitable for a process with internal flow- and error-control mechanisms. • For example, the Trivial File Transfer Protocol (TFTP) process includes flow and error control. It can easily use UDP. • UDP is a suitable transport protocol for multicasting. Multicasting capability is embedded in the UDP software but not in the TCP software. • 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 Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 11.
    TRANSMISSION CONTROL PROTOCOL •It is a connection-oriented, reliable protocol. • TCP explicitly defines connection establishment, data transfer, and connection teardown phases to provide a connection-oriented service. TCP uses a combination of • GBN and SR protocols to provide reliability • TCP uses checksum (for error detection), retransmission of lost or corrupted packets, cumulative and selective acknowledgments, and timers. • TCP is the most common transport-layer protocol in the Internet Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 12.
    TRANSMISSION CONTROL PROTOCOL •TCP provides Full Duplex service, i.e., the data flow in both the directions at the same time. • To achieve Full Duplex service, each TCP should have sending and receiving buffers so that the segments can flow in both the directions. • Establish a connection between two TCPs. • Data is exchanged in both the directions. • The Connection is terminated. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 13.
    TCP Services • TCPprovides process-to-process communication using port numbers • It 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 Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 14.
    Segments • TCP groupsa number of bytes together into a packet called a segment. • TCP adds a header to each segment (for control purposes) and delivers the segment to the network layer for transmission. • The segments are encapsulated in an IP datagram and transmitted. • segments are not necessarily all the same size Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 15.
    TCP Services • TCPperforms multiplexing at the sender and demultiplexing at the receiver • TCP is a reliable transport protocol. It uses an acknowledgment mechanism to check the safe and sound arrival of data. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 16.
    TCP Features • NumberingSystem • TCP numbers all data bytes (octets) that are transmitted in a connection. Numbering is independent in each direction. • Acknowledgment Number Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 17.
    Dr.T.Abirami, Associate Professor,Department of IT , Kongu Engineering College
  • 18.
    total six typesof flags in control field: •URG: indicates that the data in a segment is urgent. •ACK: it validates the acknowledgement number. •PSH: used to inform the sender that higher throughput is needed so if possible, data must be pushed with higher throughput. •RST: used to reset the TCP connection when there is any confusion occurs in the sequence numbers. •SYN: used to synchronize the sequence numbers in three types of segments: connection request, connection confirmation ( with the ACK bit set ), and confirmation acknowledgement. •FIN: used to inform the receiving TCP module that the sender has finished sending data. It is used in connection termination in three types of segments: termination request, termination confirmation, and acknowledgement of termination confirmation. • Window Size: The window is a 16-bit field that defines the size of the window. • Checksum: The checksum is a 16-bit field used in error detection. • Urgent pointer: is set to 1, then this 16-bit field is an offset from the sequence number indicating that it is a last urgent data byte. • Options and padding: convey the additional information to the receiver. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 19.
    A TCP Connection ConnectionEstablishment /three-way handshaking The client sends the first segment, SYN segment The server sends the second segment, a SYN + ACK segment The client sends the third segment. just an ACK segment Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 20.
    Data Transfer Dr.T.Abirami, Associate Professor,Department of IT , Kongu Engineering College
  • 21.
    Connection Termination The FIN segment consumesone sequence number if it does not carry data. Three-Way Handshaking Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College
  • 22.
    Basis for Comparison TCP UDP DefinitionTCP establishes a virtual circuit before transmitting the data. UDP transmits the data directly to the destination computer without verifying whether the receiver is ready to receive or not. Connection Type It is a Connection-Oriented protocol It is a Connectionless protocol Speed slow high Reliability It is a reliable protocol. It is an unreliable protocol. Header size 20 bytes 8 bytes acknowledgement It waits for the acknowledgement of data and has the ability to resend the lost packets. It neither takes the acknowledgement, nor it retransmits the damaged frame. Dr.T.Abirami, Associate Professor, Department of IT , Kongu Engineering College