what exactly is the difference between TCP and UDP?? as far as i know, i only use TCP, isnt TCP mainly internet related? or can someone point me where i can find some links to read up on this
Printable View
what exactly is the difference between TCP and UDP?? as far as i know, i only use TCP, isnt TCP mainly internet related? or can someone point me where i can find some links to read up on this
UDP is a "Best Effort" protocol. No error checking. TCP has error checking and resends if errors are encountered in the packet.
Recommended book: Teach Yourself TCP/IP in 14 days - this should get you basic understanding.
Regards.
<edit> Chances are that you do have some minore UDP usage and just are not aware of it. Most of your file sharing apps require one or more UDP ports to be available. To ammend the recommended reading: http://www.faqs.org/rfcs/rfc1180.html and http://compnetworking.about.com/libr.../aa071200a.htm </edit>
The best description that I have heard for udp is that udp just broadcasts like a pa system. It doesn't care if the data gets there or not, it just sends the stuff out. TCP/IP is just like chefer said. It has a check on it, if the data is not received, then it resends. Hope that clears out what udp does. Also, UDP can be a security risk if your system can be tricked to send out udp broadcasts of important info. Well, I hope that helps.
Tcp and udp work at the same level, they both carry data over IP (internet protocol).
However, tcp is a connection based protocol while udp is connection less. What this means is that tcp establishes a ("virtual") connection to the remote host before sending the actual data packets.
Both tcp and udp send data in chuncks called packets (however called "datagrams" in udp).
However, once a tcp connection is established, the tcp stack (the stack is the piece of software that manages the transmitions) handles all transmition errors by itself (for example if a packet is lost on its way (for whatever reason), the stack will automatically resend it...).
Udp does not have this capacity. If a packet is lost, you won't know about it. Thats why UDP is called "unreliable". Udp is however faster than tcp because there is not the overhead of error checking and etc.
In an analogy, tcp could be compared to a telephone call while udp would be a pager...
So, tcp is used in things like web browsing, telnet connections, ftp transfers and etc. where you can't afford to loose data on the way...
Udp is used in things like streaming media (realvideo...) networked games and etc. where losing some data is acceptable: if you lose a few bytes of streaming media data, it will just sound slightly distorted; in games (like first person shooters), skipping one player position update can be anoying, but not critical to the game's continuation...
Ammo