Giter Club home page Giter Club logo

Comments (2)

edte avatar edte commented on May 17, 2024 1
  1. 首先 2 字节应该是 65535,似乎全零不算长度
  2. UDP 负载的长度,也就是说应用层分组的长度,按照这个题的说法,它只看了 UDP 的长度字段,只需要这个字段所能表示的最大值减去 UDP 首部长度,即 65535-8=65527.
  3. 不过上面只是理论上 UDP 的长度字段所能表示的,楼上说的那个是在网络层 IP 首部中首部字段和长度字段又进行的限制,简而言之,就是说 IP 格式规定 IP 数据部分的最大值是 65535 - 20 = 65515.再减去 UDP 首部 8 为 65507,这个和 UDP 首部没有关系。
  4. 实际上如果要看其他层的长度限制的话,链路层也有 MTU 的限制,以太网就要求网络层分组最大是 1500,虽然可以分片解决,除此外还有实际的套接字缓存的大小限制等,不过都不是这个题想要考的。
  5. 总之,我认为这道题想要的考点应该就是 2 说的。

from computer-networking-a-top-down-approach-notes.

Trade-Offf avatar Trade-Offf commented on May 17, 2024

经过查阅资料,找到UDP最大有效负载的理论值:
UDP包Header中的length为2 Byte(字节),用于记录UDP包的总长度:Header+Data
2个Byte可表示的最大值为: 2^16-1=64K-1=65535,因为length的单位是Byte,所以UDP包的长度最大值为65535Byte。
又因为UDP包Header占8Byte, IP包Header占20Byte, 所以UDP的最大有效负载的理论值为65535-28 = 65507Byte.

答案来源:https://cloud.tencent.com/developer/ask/28347

from computer-networking-a-top-down-approach-notes.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.