简体   繁体   English

如果ip为4个八位字节,为什么in_addr中的s_addr是无符号长而不是无符号长?

[英]Why is s_addr within in_addr an unsigned long instead of a mere unsigned if ip's are 4 octets?

Is it for ipv6? 是ipv6吗? If ipv4 is s_addr just the dotted quad reinterpreted as a 32 bit integer? 如果ipv4是s_addr,那么只是将虚线四边形重新解释为32位整数?

unsgined long guarantees that the size of the variable is at least 4 bytes, thus holding the entire ip. unsgined long保证变量的大小至少为4个字节,从而保存整个ip。 An unsigned int can be smaller. unsigned int可以更小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM