Advertisement

difference between udp and tcp/ip?

Started by April 24, 2004 03:01 AM
4 comments, last by johnnyBravo 20 years, 9 months ago
Hi whats the difference between udp and tcp/ip?
First, understand that TCP/IP is comparable to UDP/IP. Both TCP and UDP use IP, which is why IP addresses are used for both.

TCP is a "stream" protocol. You squirt a series of bytes in one end, and they all come out the other end in the same order. It''s the way all networking would be, in a perfect world.

UDP is a datagram oriented protocol. Think of it like the postal service. You send letters through the mail. They may not all arrive in the same order they were sent in, and some may not arrive at all. Additionally, UDP has no idea of a "connection"; you never connect, you just send data.

There are a few other differences, but I think this is pretty much all the major issues. Things like fragmentation you''ll learn about in due time.

UDP is often used by games because it is potentially much more efficient than TCP, with a lower latency. Of course, you''ll have to do more work than you would with TCP in order to get it working well, since it guarantees less stuff for you.


"Sneftel is correct, if rather vulgar." --Flarelocke
Advertisement
google?
TCP (Transmission Control Protocol) is known as "connection-oriented or stream-based protocol." Under TCP, data arrive at random order and size might differ from when sent.

Benefit:
- Extremely reliable
- Robust

Drawback:

- Robust, but slower than UCP due to error check and correction
- Stream-based, thus receiver has to thoroughly analyze incoming packets

UDP (User Datagram Protocol) is part of TCP/IP protocol suite. It is known as "connnection-less or message-based protocol," where packets arrive in exact size and order as when sent.

Benefit:

- Slimmer protocol - protocol header is fixed at 8 bytes
- Ideal for messages/games where speed is more important than reliability
- Faster than TCP - there is less wait time from packets arriving at NIC and delivery to application
- Supports broadcast or multicasting

Drawback:

- Unreliable - stack makes no effort to correct lost, duplicated, or out-of-order packets.
- Corrupted packet is checked, but is simply dropped rather than recovered.

Kuphryn
IP

TCP

UDP




“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” — Brian W. Kernighan
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Informative post....

Google brought me here...

This topic is closed to new replies.

Advertisement