关于IPv6地址的结构(P23)

struct in_addr {

  uint32_t s_addr[
16];

};

  IPv6地址是128位的,因此对此生疑。经过对netinet/in.h查证,发现确实有误。以下是在in.h中的定义:

struct in6_addr
{
union
{
uint8_t __u6_addr8[
16];
#if defined __USE_MISC || defined __USE_GNU
uint16_t __u6_addr16[
8];
uint32_t __u6_addr32[
4];
#endif
} __in6_u;

 

相关文章: