Unit 1, Endian

Unit 1, Endian_第1张图片

Caution: Different processors layout numbers differently. Byte order,不同处理器的byte排序方式是不同的,有分big endian和little endian。E.g. 在比较network传来的port地址和本地host的port地址时,记得进行byte order转换。Host and network order can be different. Internet protocols decide how the order is laid out.

Total length 这一个field的最大长度为65,535,因为它占了16bit,2 bytes。用这2个byte的空间表示total length,2^16=65535。

Say the “total length” field stores the number 1400, so the third and forth byte of an IP packet correspond to 0x05 and 0x78, stored in a big endian format.

你可能感兴趣的:(网络)