LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   TCP vs. UDP (https://www.linuxquestions.org/questions/linux-networking-3/tcp-vs-udp-60320/)

mikeshn 05-17-2003 12:27 PM

TCP vs. UDP
 
What do you think is better ?

TCP or UDP ?

dorian33 05-17-2003 12:52 PM

Depends on purpose.

Midnight Rain 05-17-2003 01:31 PM

purpose doesn't really matter all to much tcp is much better than udp as far as a protocol goes but UDP does have it's purposes where nothing else would do. As far as basic functionality TCP is better because it has error checking built in where as UDP is simple best effort delivery. On transferring a file with UDP you may get it all you may not. You are going to get it all with TCP whatever is on the host computer is what you get everytime.

Robert0380 05-17-2003 02:41 PM

what Rain said, TCP is what you want for reliable connections, examples include HTTP, FTP, TELNET, SSH. When a computer sends data, the reciever sends back an ACK (acknowledge) and if the there is no ACK recieved after a period of time, the sender re-sends the data. In UDP its just send it and hope it gets there. UDP is used in DHCP, DNS (i think), RIP and other protocols that dont require a reliable connection.

Looking_Lost 05-17-2003 03:03 PM

And UDP is the default delivery mechanism for most streaming media
- less overhead involved and less likely to experience "stutter" when playing back as there's no hanging about waiting for acknowledgements

Mara 05-17-2003 04:14 PM

There's no "better" or "worser". TCP is connection oriented, used when you'd like to send data and be sure it was received (mail, ftp, www and many other uses). UDP is connection-less, when you don't want/don't need to know if the data was received (and you don't need/want retransmissions). It may be used for video, VoIP etc.

When you send VoIP, a loss of one piece is not a problem - people will be able to understand each other. The same with video. That's why UDP is used there.

Oh...Forgot one thing. UDP is faster. You don't need to connect. So when I want just to send short data, I prefer UDP.


All times are GMT -5. The time now is 04:58 PM.