Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
UDP and TCP both sit on top of IP. The main difference is that UDP is not reliable, i.e. it has no mechanism for error recovery, built into the protocol, whereas TCP does. The second main difference is that TCP is a windowing protocol whereas UDP isn't.
The main reason for choosing TCP is where you need your data to be sent with guarentee's to the application that it will get through. With UDP if a packet fails to get through it is up to the application to recognise it and correct the situation. The price you pay is that error recovery requires overheads, so TCP is less bandwidth efficient than UDP and requires more memory per session on ends hosts. Like any engineering solution its a trade off.
An example that says it all - File Transfer Protocol runs over TCP and is designed to transmit large files over long distances (in a networking sense)
'Trivial' File Transfer Protocol runs over UDP and is designed to transfer small files over short distances, where a failure is easily manually rectified.
Due to its unreliability (as posted in baldy3105's comment), UDP is a faster transport protocol.
~Myles
This is not quite true. Due to its lack of overhead UDP is slightly faster in conditions where the end to end latency is small compared to the packet transmission time.
Due to its lack of windowing, where end to latency is greater than packet transmission time, UDP is unable to fill the time gaps and therefore rapidly becomes less efficient than TCP.
UDP is the protocol for gaming, cause you don't want to go back retrieving packets when the gameplay has moved past that point.
Correct, the same reason that it's the protocol used for VOIP. Theres no point in recovering packets when they become useless after 150mS and would dumped by the codec anyway.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.