UDP 与 IP 的区别?
据我了解,UDP 驻留在传输层,IP 驻留在互联网层。我还知道它们都是无连接且不可靠的。那么当我们已经有了IP的时候,UDP还有什么意义呢?区别不是很清楚。非常感谢对此的任何帮助。谢谢!
I understand that UDP resides on the transport layer and IP on the internet layer. I also get that they're both connectionless and unreliable. Then what is the point of UDP when we already have IP? The distinction is not very clear. Any help on this is greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实现多路复用服务。
UDP
端口号可以使用相同的 L3 标识来区分同一主机上的多个服务。仅使用IP
不可能在同一个站点上托管多个服务并轻松区分它们。另外,请考虑 IPv6 上的 UDP 的情况。由于 IPv6 没有错误检查功能,必须有人执行它:UDP 的
校验和
字段不是可选的。To multiplex services. The
UDP
port number can differentiate between multiple services on the same host, using the same L3 identification. UsingIP
only it wouldn't be possible to host multiple services on the same station and easily differentiate between them.Also, consider the case of UDP over IPv6. Since IPv6 doesn't have error-checking somebody has to perform it: the
Checksum
field of UDP is not optional.一旦数据包使用其 IP 地址到达主机,就需要将该数据包提供给该计算机上的应用程序之一。为了确定哪个应用程序应该获取数据包,它需要基于端口的解复用逻辑。 UDP 具有 IP 使用的端口信息,将数据包传送到适当的应用程序。
Once a packet reaches a host using its IP address, the packet needs to be given to one of the applications on this machine. To determine which application should get the packet, it needs demultiplexing logic, which is based on ports. UDP has port information which is used by IP to deliver the packet to appropriate application.