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
TCP UDP
Acronym for Transmission Control Protocol User Datagram Protocol or
Universal Datagram Protocol
Connection TCP is a connection-oriented UDP is a connectionless
protocol. protocol.
Function As a message makes its way UDP is also a protocol used in
across the internet from one message transport or transfer.
computer to another. This is This is not connection based
connection 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 UDP is suitable for applications
require high reliability, and that need fast, efficient
transmission time is relatively less transmission, such as games.
critical. UDP's stateless nature is also
useful for servers that answer
small queries from huge
numbers of clients.
Use by other HTTP, HTTPs, FTP, SMTP, DNS, DHCP, TFTP, SNMP,
protocols Telnet RIP, VOIP.
Ordering of data TCP rearranges data packets in UDP has no inherent order as
packets the order specified. all packets are 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 is faster because error
UDP. recovery is not attempted. It is
a "best effort" protocol.
Reliability There is absolute guarantee that There is no guarantee that the
the data transferred remains intact messages or packets sent
and arrives in the same order in would reach at all.
which it was sent.
Header Size TCP header size is 20 bytes UDP Header size is 8 bytes.
Common Header Source port, Destination port, Source port, Destination port,
Fields Check Sum Check Sum
Streaming of data Data is read as a byte stream, no Packets are sent individually
distinguishing indications are and are checked for integrity
transmitted to signal message only if they arrive. Packets
(segment) boundaries. have definite boundaries which
are honored upon receipt,
meaning a read operation at
the receiver socket will yield an
entire message as it was
originally sent.
Weight TCP is heavy-weight. TCP UDP is lightweight. There is no
requires three packets to set up a ordering of messages, no
socket connection, before any tracking connections, etc. It is a
user data can be sent. TCP small transport layer designed
handles reliability and congestion on top of IP.
control.
Data Flow Control TCP does Flow Control. TCP UDP does not have an option
requires three packets to set up a for flow control
socket connection, before any
user data can be sent. TCP
handles reliability and congestion
control.
Error Checking TCP does error checking and UDP does error checking but
error recovery. Erroneous packets simply discards erroneous
are retransmitted from the source packets. Error recovery is not
to the destination. attempted.
Fields 1. Sequence Number, 2. AcK 1. Length, 2. Source port, 3.
number, 3. Data offset, 4. Destination port, 4. Check Sum
Reserved, 5. Control bit, 6.
Window, 7. Urgent Pointer 8.
Options, 9. Padding, 10. Check
Sum, 11. Source port, 12.
Destination port
Acknowledgement Acknowledgement segments No Acknowledgment
Handshake SYN, SYN-ACK, ACK No handshake (connectionless
protocol)