I know the difference between the two on a technical level.
But in real life, can anyone provide examples (the more the better) of applications (uses) of TCP and UDP to demonstrate the difference?
|
|
|
UDP: Anything where you don't care too much if you get all data always
TCP: Almost anything where you have to get all transmitted data
EDIT: I'm not going to bother explaining the differences, since you state that you already know and every other answer explains it anyway :) |
||||
|
|
|
UDP is mailing a letter at the post office. TCP is mailing a letter with a return receipt at the post office, except that the post master will organize the letters in-order-of mailing and only deliver them in-order. Well, it was an attempt anyway. |
|||
|
|
|
The classic standpoint is to consider TCP as safe and UDP as unreliable. But when TCP-IP protocols are used in safety critical applications, TCP is not recommended because it can stop on error for multiple reasons. Whereas UDP lets the application software deal with errors, retransmission timers, etc. Moreover, TCP has more processing overhead than UDP. Currently, UDP is used in aircraft controls and flight instruments, in the ARINC 664 standard also named AFDX (Avionics Full-Duplex Switched Ethernet). In ARINC 664, TCP is optional but UDP is used with the RTOS (real time operating systems) designed for the ARINC 653 standard (high reliability control software in civil aircrafts). For more information about real time controls using IP and UDP in AFDX, you can read the pages 27 to 50 in http://www.afdx.com/pdf/AFDX_Training_October_2010_Full.pdf |
|||
|
|
|
TCP:
UDP:
|
||||
|
|
|
TCP I will not send data anymore until i get an acknowledgment. this process is slow It is used for security purpose example: web, sending mail, receiving mail etc UDP Here i have no headache with acknowledgment. this process is faster but here data can be lost . example : video streaming , online games etc TCP + UDP = SMTP(example : mobile,telephone) |
||||
|
|
|
TCP guarantees (in-order) packet delivery. UDP doesn't. TCP - used for traffic that you need all the data for. i.e HTML, pictures, etc. UDP - used for traffic that doesn't suffer much if a packet is dropped, i.e. video & voice streaming, some data channels of online games, etc. |
|||||||||||||||||||||
|
|
TCP is a connection oriented protocol, It establishes a path, or a virtual connection all the way through switches routers proxies etc and then starts any communication. Various mechanisms like routing djikstras shortest path algorithm exist to establish the virtual end to end connection. So it finds itself used while browsing HTML and other pages, making payments and web applications in general. UDP is a connectionless protocol - it simply has a destination and nodes simply pass it along if it comes as best as they can. So packets arriving out of order, along various routes etc are common. So Instant messengers and similar software developers think UDP an ideal solution. In real life if you want to throw data in the net, without worrying about time taken to reach, order of reaching use UDP. If you want a solid path before you start throwing packets, and want same order and latency for your data packets use TCP - I will use UDP for Torrents and TCP for PayPal! |
|||
|
|
REAL TIME APPLICATION FOR TCP:Email: Reason: suppose if some packet(words/statement) is missing we cannot understand the content.It should be reliable. REAL TIME APPLICATION FOR UDP:video streaming: * **Reason: ***suppose if some packet(frame/sequence) is missing we can understand the content.Because video is collection of frames.For 1 second video there should be 25 frames(image).Even though we can understand some frames are missing due to our imagination skills. Thats why UDP is used for video streaming. |
|||||
|
|
TCP is appropriate when you have to move a decent amount of data (> ~1 kB), and you require all of it to be delivered. Almost all data that moves across the internet does so via TCP - HTTP, SMTP, BitTorrent, SSH, etc, all use TCP. UDP is appropriate when you have small messages which you can afford to lose, and would like to send them as efficiently as possible. One reason you might be able to afford to lose them is because you can re-send them if they get lost. The main example on the internet is DNS - DNS consists of small queries saying things like "what is the IP number for stackoverflow.com?", and the responses are correspondingly small. Computers make a lot of these queries, so they should be made efficiently, but if they get lost en route, it's easy to time out and re-send them. |
|||||||||||||||||
|
|
TCP guarantees packet delivery AND order. Order is almost as important as the delivery in the first place when reconstructing data for files such as executables, etc. UDP does not guarantee delivery NOR order. Packets can arrive (or not!) in any order. Common uses for TCP include file transfer where the integrity of the packets is paramount. Voice/video applications can afford to lose some data while still maintaining acceptable quality, and so usually use UDP. |
|||
|
|
|
|||
|
|
|
One additional thought on some of the comments above that talks about ordered delivery.... It must be clarified that the destination computer may receive packets out of order on the wire, but the TCP at the destination is responsible for "rearranging out-of-order data" before passing it on to the upper layers of the stack. When you say TCP guarantees ordered packet delivery, what that means is it will deliver packets in correct order to the upper layers of the stack. |
|||
|
|
|
||||
|
|
|
UDP is applied a lot in games or other Peer-to-peer setups because it's faster and most of the time you don't need the protocol itself to make sure everything gets to the destination in the original order (UDP does not garantee packet delivery or delivery order). Web traffic on the other hand is over TCP. (I'm not sure here but I think it has to do with the way the HTTP protocol is built) Edited because I failed at UDP. |
|||
|
|
|
Real life examples of both TCP and UDP tcp -> a phone call, sms or anything specific to destination UDP -> a FM radio channel (AM), Wi-Fi. |
|||||||||
|