由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
EmergingNetworking版 - question on TCP and UDP header
相关主题
请教一个TCP的问题 (转载)L2TP协议
网络技术问题这个MPLS enabled application细细看来是一本好书啊
A question about routers and BGP[Job Opening] Senior Game Network Programmer
极度怀疑comcast的限速请问用dd-wrt建基于router的vpn
在线听歌一类的应用是用TCP吗?还是UDP? (转载)有兴趣搞一个userspace的nat实现吗
借宝地问个问题Fragment Traffic倒底有多普遍?
问道经典的网络面试题。How many nexthops?
VPN question: without router it connects, with route it's n (转载)NAT tranverse introduction 1
相关话题的讨论汇总
话题: tcp话题: header话题: udp话题: checksum话题: length
进入EmergingNetworking版参与讨论
1 (共1页)
z*y
发帖数: 1311
1
为什么UDP header里有length field,而TCP header却没有?
a**********k
发帖数: 1953
2
datagram vs. stream

【在 z*y 的大作中提到】
: 为什么UDP header里有length field,而TCP header却没有?
s*****g
发帖数: 1055
3
Good question! I searched Google, the consensus of all answers is that the
length field in either TCP or UDP (or lack there of) is redundant, because
the length can always be inferred from IP payload length minus UDP/TCP
header size.

【在 z*y 的大作中提到】
: 为什么UDP header里有length field,而TCP header却没有?
v**n
发帖数: 951
4
none of them is needed.
the length field makes it a good alignment, i guess.

【在 z*y 的大作中提到】
: 为什么UDP header里有length field,而TCP header却没有?
z*y
发帖数: 1311
5

I know, that is why I ask.
Since both are redundant. Why is included in UDP but not TCP?
I guess not every engineering decision has a reason.

【在 v**n 的大作中提到】
: none of them is needed.
: the length field makes it a good alignment, i guess.

z**r
发帖数: 17771
6
agree, and TCP UDP were designed by different groups

【在 v**n 的大作中提到】
: none of them is needed.
: the length field makes it a good alignment, i guess.

z**r
发帖数: 17771
7
did a quick search
http://stackoverflow.com/questions/281606/why-does-udp-have-a-l
There is a 96 bit pseudo header conceptually prefixed to the TCP header that
contains the information already.
The checksum field description from this source gives the answer:
Checksum: 16 bits
The checksum field is the 16 bit one's complement of the one's complemen
t sum of all 16 bit words in the header and text. If a segment contains an o
dd number of header and text octets to be checksummed, the last octet is pad
ded on the right with zeros to form a 16 bit word for checksum purposes. The
pad is not transmitted as part of the segment. While computing the checksum
, the checksum field itself is replaced with zeros.
The checksum also covers a 96 bit pseudo header conceptually prefixed to
the TCP header. This pseudo header contains the Source Address, the Destina
tion Address, the Protocol, and TCP length. This gives the TCP protection ag
ainst misrouted segments. This information is carried in the Internet Protoc
ol and is transferred across the TCP/Network interface in the arguments or r
esults of calls by the TCP on the IP.
+--------+--------+--------+--------+
| Source Address |
+--------+--------+--------+--------+
| Destination Address |
+--------+--------+--------+--------+
| zero | PTCL | TCP Length |
+--------+--------+--------+--------+
The information is not needed at the TCP level since TCP is a stream based p
rotocol.

【在 z**r 的大作中提到】
: agree, and TCP UDP were designed by different groups
B*****R
发帖数: 1539
8
赫赫,面试时没词儿了我就喜欢问UDP CHECKSUM怎么算的

field-in-the-header-and-tcp-does-not
that
complemen
an o
pad
The

【在 z**r 的大作中提到】
: did a quick search
: http://stackoverflow.com/questions/281606/why-does-udp-have-a-l
: There is a 96 bit pseudo header conceptually prefixed to the TCP header that
: contains the information already.
: The checksum field description from this source gives the answer:
: Checksum: 16 bits
: The checksum field is the 16 bit one's complement of the one's complemen
: t sum of all 16 bit words in the header and text. If a segment contains an o
: dd number of header and text octets to be checksummed, the last octet is pad
: ded on the right with zeros to form a 16 bit word for checksum purposes. The

x*********n
发帖数: 28013
9
you are way too evil..

【在 B*****R 的大作中提到】
: 赫赫,面试时没词儿了我就喜欢问UDP CHECKSUM怎么算的
:
: field-in-the-header-and-tcp-does-not
: that
: complemen
: an o
: pad
: The

z**r
发帖数: 17771
10
good question

【在 B*****R 的大作中提到】
: 赫赫,面试时没词儿了我就喜欢问UDP CHECKSUM怎么算的
:
: field-in-the-header-and-tcp-does-not
: that
: complemen
: an o
: pad
: The

f*****n
发帖数: 646
11
UDP里的length看来是多余的, stevens那本书里也这么说
但是TCP要length有啥用? 本来就是stream oriented protocol, length这个概念就不
适合TCP

that
complemen
o
pad
The

【在 z**r 的大作中提到】
: did a quick search
: http://stackoverflow.com/questions/281606/why-does-udp-have-a-l
: There is a 96 bit pseudo header conceptually prefixed to the TCP header that
: contains the information already.
: The checksum field description from this source gives the answer:
: Checksum: 16 bits
: The checksum field is the 16 bit one's complement of the one's complemen
: t sum of all 16 bit words in the header and text. If a segment contains an o
: dd number of header and text octets to be checksummed, the last octet is pad
: ded on the right with zeros to form a 16 bit word for checksum purposes. The

u**n
发帖数: 44
12
TCP has checksum field so that application can verify data integrity by
given TCP packet. UDP checksum could be zero so that application needs to
know how many bytes are valid.
My guess...

【在 z*y 的大作中提到】
: 为什么UDP header里有length field,而TCP header却没有?
m**t
发帖数: 1292
13
There is an offset field to contain the option header length though
1 (共1页)
进入EmergingNetworking版参与讨论
相关主题
NAT tranverse introduction 1在线听歌一类的应用是用TCP吗?还是UDP? (转载)
Troubleshooting Challenge借宝地问个问题
Cisco 10G WS-X6708-10GE 质量问题问道经典的网络面试题。
为什么L2SC用MST而router用SPFVPN question: without router it connects, with route it's n (转载)
请教一个TCP的问题 (转载)L2TP协议
网络技术问题这个MPLS enabled application细细看来是一本好书啊
A question about routers and BGP[Job Opening] Senior Game Network Programmer
极度怀疑comcast的限速请问用dd-wrt建基于router的vpn
相关话题的讨论汇总
话题: tcp话题: header话题: udp话题: checksum话题: length