为什么 UDP 在标头中有长度字段而 TCP 没有? [英] Why does UDP have a length field in the header and TCP does not?

查看:47
本文介绍了为什么 UDP 在标头中有长度字段而 TCP 没有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 UDP 的头部有长度字段,而 TCP 没有?

Why does UDP have a length field in the header and TCP does not?

我猜测 TCP 中的段长度是从 IP 标头推断出来的,但是对于 UDP 数据报应该能够做到这一点

I am guessing that the length of the segment in TCP is inferred from the IP header but one should be able to do the same for a UDP datagram

推荐答案

根据TCP/IP Illustrated Volume 1,长度字段是多余的.这就是史蒂文斯对此事所说的全部内容.

According to TCP/IP Illustrated Volume 1, the length field is redundant. That's all Stevens says on the matter.

我个人认为这是为了使 UDP 标头长度(以位为单位)可被 32 整除 :)

I personally believe it was to make the UDP header length (in bits) divisible by 32 :)

这篇关于为什么 UDP 在标头中有长度字段而 TCP 没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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