You are on page 1of 3

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. This
computer to another. This is is not connection based which
connection based. 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 UDP is suitable for applications
that require high reliability, and that need fast, efficient
transmission time is relatively transmission, such as games.
less 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, RIP,
protocols Telnet VOIP.
Ordering of data TCP rearranges data packets in UDP has no inherent order as all
packets the order specified. 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 UDP is faster because error
than 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 messages or packets sent would
intact and arrives in the same reach at all.
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, Source port, Destination port,
Fields Check Sum Check Sum
Streaming of data Data is read as a byte stream, Packets are sent individually and
no distinguishing indications are checked for integrity only if
are transmitted to signal they arrive. Packets have definite
message (segment) boundaries. 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 ordering of messages, no tracking
a socket connection, before any connections, etc. It is a small
user data can be sent. TCP transport layer designed on top of
handles reliability and IP.
congestion control.
Data Flow Control TCP does Flow Control. TCP UDP does not have an option for
requires three packets to set up flow control
a 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 simply discards erroneous packets.
packets are retransmitted from Error recovery is not attempted.
the source to the destination.
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)
Basis for HTTP FTP
Comparison
Basic HTTP is used to access websites. FTP transfers file from one one
host to another.
Connection HTTP establishes data connection FTP establishes two connection
only. one for data and one for the
control connection.
TCP ports HTTP uses TCP's port number 80. FTP uses TCP's port number 20
and 21.
URL If you are using HTTP, http will If you are using FTP, ftp will
appear in URL. appear in URL.
Efficient HTTP is efficient in transferring FTP is efficient in transferring
smaller files like web pages. larger files.
Authentication HTTP does not require FTP requires a password.
authentication.
Data The content transferred to a device The file transferred to the host
using HTTP is not saved to the device using FTP is saved in the
memory of that device. memory of that host device.

You might also like