TCP和UDP之间的区别? [英] Difference between TCP and UDP?

查看:110
本文介绍了TCP和UDP之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

TCP和UDP有什么区别?

What is the difference between TCP and UDP?

我知道TCP用于非时间紧迫的应用程序,而UDP用于需要快速传输数据的游戏或应用程序.我知道TCP用于HTTP,HTTP,FTP,SMTP和Telnet.我知道UDP用于DNS和DHCP.

I know that TCP is used in the case of non-time critical applications, and UDP is used for games or applications that require fast transmission of data. I know that TCP is used for HTTP, HTTPs, FTP, SMTP, and Telnet. I know that UDP is used for DNS and DHCP.

但是为什么呢? TCP和UDP的哪些特性使其对于各自的用例有用?

But why? What characteristics of TCP and UDP make it useful for their respective use cases?

推荐答案

TCP是IP网络上面向连接的流.它保证所有发送的数据包都将以正确的顺序到达目的地.这意味着使用发回给发件人的确认数据包和自动重传,这会导致额外的延迟,并且传输效率通常低于UDP.

TCP is a connection oriented stream over an IP network. It guarantees that all sent packets will reach the destination in the correct order. This imply the use of acknowledgement packets sent back to the sender, and automatic retransmission, causing additional delays and a general less efficient transmission than UDP.

UDP是无连接协议.通信是面向数据报的.仅在单个数据报上保证完整性.数据报到达目的地,并且可能无序到达或根本不到达.它比TCP更有效,因为它使用了非 ACK .它通常用于实时通信,在这种情况下,丢包率的百分比要比TCP连接的开销小.

UDP is a connection-less protocol. Communication is datagram oriented. The integrity is guaranteed only on the single datagram. Datagrams reach destination and can arrive out of order or don't arrive at all. It is more efficient than TCP because it uses non ACK. It's generally used for real time communication, where a little percentage of packet loss rate is preferable to the overhead of a TCP connection.

在某些情况下使用UDP是因为它允许广播数据包传输.在诸如DHCP协议的情况下,这有时是基本的,因为客户端计算机仍未收到IP地址(这是DHCP协商协议的目的),并且无法建立流,而没有IP地址本身.

In certain situations UDP is used because it allows broadcast packet transmission. This is sometimes fundamental in cases like DHCP protocol, because the client machine hasn't still received an IP address (this is the DHCP negotiaton protocol purpose) and there won't be any way to establish a TCP stream without the IP address itself.

这篇关于TCP和UDP之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆