LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-24-2006, 07:39 AM   #1
itz2000
Member
 
Registered: Jul 2005
Distribution: Fedora fc4, fc7, Mandrake 10.1, mandriva06, suse 9.1, Slackware 10.2, 11.0, 12.0,1,2 (Current)]
Posts: 732

Rep: Reputation: 30
What's the difference between (UDP and TCP)/IP?


What's the difference between (UDP and TCP)/IP?

Why to prefer using one over another?
 
Old 01-24-2006, 08:42 AM   #2
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
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.

Last edited by baldy3105; 01-24-2006 at 08:47 AM.
 
Old 01-24-2006, 11:21 AM   #3
Dmjmusser
Member
 
Registered: Nov 2005
Location: Detroit, Michigan -- USA
Distribution: Fedora Core
Posts: 90

Rep: Reputation: 15
Due to its unreliability (as posted in baldy3105's comment), UDP is a faster transport protocol.

~Myles
 
Old 01-25-2006, 05:56 AM   #4
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by Dmjmusser
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.
 
Old 01-25-2006, 06:08 AM   #5
cs-cam
Senior Member
 
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545

Rep: Reputation: 57
UDP is the protocol for gaming, cause you don't want to go back retrieving packets when the gameplay has moved past that point.
 
Old 01-25-2006, 06:19 AM   #6
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by cs-cam
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP/UDP Confusion blackhole123 Linux - Networking 1 11-15-2005 03:46 AM
tcp/udp and c++ Kroenecker Programming 1 05-10-2005 11:56 AM
UDP over TCP The_Nerd Programming 7 07-21-2004 09:45 PM
TCP vs. UDP mikeshn Linux - Networking 5 05-17-2003 04:14 PM
TCP forward works, why not UDP?? Pcghost Linux - Networking 4 02-19-2003 10:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration