Sunteți pe pagina 1din 1

Difference between TCP and UDP Protocol

TCP(Transmission Control Protocol). TCP is a


connection-oriented protocol, a connection
can be made from client to server, and from
then on any data can be sent along that
connection.
UDP(User Datagram Protocol). A simpler
message-based connectionless protocol. With
UDP you send messages(packets) across the
network in chunks.
Reliable when you send a message along a
TCP socket, you know it will get there unless the
connection fails completely. If it gets lost along
the way, the server will re-request the lost part.
This means complete integrity, things dont get
corrupted.
Unreliable When you send a message, you
dont know if itll get there, it could get lost on
the way.
Ordered if you send two messages along a
connection, one after the other, you know the
first message will get there first. You dont have
to worry about data arriving in the wrong order.
Not ordered If you send two messages out,
you dont know what order theyll arrive in.
Heavyweight when the low level parts of the
TCP stream arrive in the wrong order, resend
requests have to be sent, and all the out of
sequence parts have to be put back together, so
requires a bit of work to piece together.
Lightweight No ordering of messages, no
tracking connections, etc. Its just fire and
forget! This means its a lot quicker, and the
network card / OS have to do very little work to
translate the data back from the packets.
Overview of TCP and UDP
TCP (Transmission Control Protocol) is the most commonly used protocol on the Internet.
The reason for this is because TCP offers error correction. When the TCP protocol is used there
is a guaranteed delivery. This is due largely in part to a method called flow control. Flow
control determines when data needs to be re-sent, and stops the flow of data until previous
packets are successfully transferred. This works because if a packet of data is sent, a collision
may occur. When this happens, the client re-requests the packet from the server until the whole
packet is complete and is identical to its original.

UDP (User Datagram Protocol) is anther commonly used protocol on the Internet. However,
UDP is never used to send important data such as web pages, database information, etc; UDP is
commonly used for streaming audio and video. Streaming media such as Windows Media audio
files (.WMA) , Real Player (.RM), and others use UDP because it offers speed! The reason UDP
is faster than TCP is because there is no form of flow control or error correction. The data sent
over the Internet is affected by collisions, and errors will be present. Remember that UDP is only
concerned with speed. This is the main reason why streaming media is not high quality.

S-ar putea să vă placă și