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

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

问题描述

为什么UDP的标头中有一个length字段,而TCP却没有?

我猜想TCP的段长是从IP标头推断出来的,但是对于UDP数据报应该可以做到这一点

解决方案

根据 TCP/IP图解卷1 ,长度字段是多余的.这就是史蒂文斯在这件事上所说的一切.

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

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

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

解决方案

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

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

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

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