Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

TCP

Vs
UDP
What is TCP & UDP ?

How do they operate ?

Comparison
About
• There are two types of Internet Protocol (IP) traffic.

• They are TCP or Transmission Control Protocol and UDP or User Datagram
Protocol.

• TCP is connection oriented – once a connection is established, data can be


sent bidirectional.

• UDP is a simpler, connectionless Internet protocol. Multiple messages are


sent as packets in chunks using UDP.
About
A service is considered connection-oriented if it has the following
characteristics:

• A virtual circuit, or “three-way handshake,” is set up.


• It uses sequencing.
• It uses acknowledgments.
• It uses flow control.
What is TCP ?
• TCP (Transmission Control Protocol) is an important network protocol that is
used in the transmission of data over networks.

• A protocol, in the context of networks, is a set of rules and procedures that


govern how the transmission of data is carried out so that everyone in the
whole world, independent of the location, software or hardware used, does
the thing the same way.

• TCP is a connection-oriented protocol, which means a connection is


established and maintained until the application programs at each end have
finished exchanging messages.(This is called a Virtual Circuit)
What is TCP ?
The function of TCP is to control the transfer of data such that it is reliable.

On networks data is transmitted in packets, which are units of data that are
sent independently on the network, and are reassembled in order once they
reach the destination

It determines how to break application data into packets that networks can
deliver, sends packets to and accepts packets from the network layer, manages
flow control.
What is TCP ?

It is meant to provide error-free data transmission—handles retransmission


of dropped or garbled packets as well as acknowledgement of all packets that
arrive.

In the Open Systems Interconnection (OSI) communication model, TCP covers


parts of Layer 4, the Transport Layer, and parts of Layer 5, the Session Layer.
How TCP Works ?
• TCP labels its packets such that they are numbered.

• It also makes sure they have a deadline to reach the destination (which is a duration
of several hundred milliseconds called time-out) and some other technical provisions.

• For each packet received, the sending device is notified through a packet called
acknowledgment.

• If after the time-out, no acknowledgment is received, the source sends another copy
of the probably missing or delayed packet.

• Out-of-order packets are also not acknowledged. This way, all packets are always
assembled in order, without holes and within a predetermined and acceptable delay.
SYN
SENDER RECEIVER

SYN, ACK

ACK

CONNECTION ESTABLISHED

Client Ports Service Ports


1024 - 65535
Data Transfer 1 - 1023
Send bytes of segments
What is UDP ?
• UDP stands for User Datagram Protocol — a datagram is the same thing as a
packet of information. The UDP protocol works similarly to TCP, but it throws
all the error-checking stuff out.

• All the back-and-forth communication and deliverability guarantees slow


things down.

• When using UDP, packets are just sent to the recipient. The sender will not
wait to make sure the recipient received the packet — it will just continue
sending the next packets.
What is UDP ?
• If you are the recipient and you miss some UDP packets, too bad — you can
not ask for those packets again.

• There is no guarantee you are getting all the packets and there is no way to
ask for a packet again if you miss it, but losing all this overhead means the
computers can communicate more quickly.

• UDP is used when speed is desirable and error correction is not necessary.
For example, UDP is frequently used for live broadcasts and online games.
What is UDP ?
• UDP enables process-to-process communication, whereas TCP supports
host-to-host communication.

• UDP can also be used in applications that require lossless data transmission
when the application is configured to manage the process of retransmitting
lost packets and correctly arranging received packets.

• It allows packets to be dropped and received in a different order than they


were transmitted, making it suitable for real-time applications where latency
might be a concern.
TCP vs UDP
  TCP UDP
Acronym for Transmission Control Protocol User Datagram Protocol or Universal
Datagram Protocol
Connection TCP is a connection-oriented protocol. UDP is a connectionless protocol.
Function As a message makes its way across the UDP is also a protocol used in message
internet from one computer to another. transport or transfer. This is not connection
This is connection based. based which means that one program can
send a load of packets to another and that
would be the end of the relationship.

Usage TCP is suited for applications that require UDP is suitable for applications that need fast,
high reliability, and transmission time is efficient transmission, such as games. UDP's
relatively less critical. stateless nature is also useful for servers that
answer small queries from huge numbers of
clients.

Use by other HTTP, HTTPs, FTP, SMTP, Telnet DNS, DHCP, TFTP, SNMP, RIP, VOIP.
protocols
TCP vs UDP
  TCP UDP
Ordering of data TCP rearranges data packets in the order UDP has no inherent order as all packets are
packets specified. independent of each other. If ordering is
required, it has to be managed by the
application layer.
Speed of transfer The speed for TCP is slower than UDP. UDP is faster because error recovery is not
attempted. It is a "best effort" protocol.
Reliability There is absolute guarantee that the data There is no guarantee that the messages or
transferred remains intact and arrives in packets sent would reach at all.
the same order in which it was sent.
Header Size TCP header size is 20 bytes UDP Header size is 8 bytes.
Common Header Source port, Destination port, Check Sum Source port, Destination port, Check Sum
Fields
Weight TCP is heavy-weight. TCP requires three UDP is lightweight. There is no ordering of
packets to set up a socket connection, messages, no tracking connections, etc. It is a
before any user data can be sent. TCP small transport layer designed on top of IP.
handles reliability and congestion control.
TCP vs UDP
  TCP UDP
Data Flow Control TCP does Flow Control. TCP requires three UDP does not have an option for flow
packets to set up a socket connection, before any control
user data can be sent. TCP handles reliability and
congestion control.

Error Checking TCP does error checking and error recovery. UDP does error checking but simply
Erroneous packets are retransmitted from the discards erroneous packets. Error
source to the destination. recovery is not attempted.

Fields 1. Sequence Number, 2. AcK number, 1. Length,


3. Data offset, 4. Reserved, 5. Control bit, 2. Source port
6. Window, 7. Urgent Pointer, 8. Options, 3. Destination port
9. Padding, 10. Check Sum, 11. Source port, 4. Check Sum
12. Destination port

Acknowledgement Acknowledgement segments No Acknowledgment


Handshake SYN, SYN-ACK, ACK No handshake (connectionless
protocol)

You might also like