socket常用地址定义

来源:互联网 发布:o2o软件测试计划 编辑:程序博客网 时间:2024/05/17 21:54

ipv4

/* Address to accept any incoming messages. */

#define    INADDR_ANY        ((unsigned long int) 0x00000000)

/* Address to send to all hosts. */
#define    INADDR_BROADCAST    ((unsigned long int) 0xffffffff)

/* Address indicating an error return. */
#define    INADDR_NONE        ((unsigned long int) 0xffffffff)

/* Network number for local host loopback. */
#define    IN_LOOPBACKNET        127

/* Address to loopback in software to local host.  */
#define    INADDR_LOOPBACK        0x7f000001    /* 127.0.0.1   */
#define    IN_LOOPBACK(a)        ((((long int) (a)) & 0xff000000) == 0x7f000000)

ipv6

/* IPv6 Wildcard Address and Loopback Address defined by RFC2553 */
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
const struct in6_addr in6addr_linklocal_allnodes = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
const struct in6_addr in6addr_linklocal_allrouters = IN6ADDR_LINKLOCAL_ALLROUTERS_INIT;



原创粉丝点击