Difference Between TCP and UDP: Reliability Reliability

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

Difference between TCP and UDP

TCP

UDP

Reliability: TCP is connection-oriented

Reliability: UDP is connectionless protocol.

protocol. When a file or message send it will

When you a send a data or message, you

get delivered unless connections fails. If

don't know if it'll get there, it could get lost on

connection lost, the server will request the lost the way. There may be corruption while
part. There is no corruption while transferring transferring a message.
a message.
Ordered: If you send two messages along a

Ordered: If you send two messages out, you

connection, one after the other, you know the don't know what order they'll arrive in i.e. no
first message will get there first. You don't

ordered

have to worry about data arriving in the wrong


order.
Heavyweight: - when the low level parts of the Lightweight: No ordering of messages, no
TCP "stream" arrive in the wrong order,

tracking connections, etc. It's just fire and

resend requests have to be sent, and all the

forget! This means it's a lot quicker, and the

out of sequence parts have to be put back

network card / OS have to do very little work

together, so requires a bit of work to piece

to translate the data back from the packets.

together.
Streaming: Data is read as a "stream," with

Datagrams: Packets are sent individually and

nothing distinguishing where one packet ends are guaranteed to be whole if they arrive.
and another begins. There may be multiple

One packet per one read call.

packets per read call.


Examples: World Wide Web (Apache TCP

Examples: Domain Name System (DNS UDP

port 80), e-mail (SMTP TCP port 25 Postfix

port 53), streaming media applications such

MTA), File Transfer Protocol (FTP port 21)

as IPTV or movies, Voice over IP (VoIP),

and Secure Shell (OpenSSH port 22) etc.

Trivial File Transfer Protocol (TFTP) and


online multiplayer games etc

You might also like