导航

socket三种地址结构

/* <sys/socket.h> */
struct sockaddr {
    uint8_t sa_len;
    sa_family_t sa_family;
    char sa_data[14];
};
/* <netinet/in.h> */
struct sockaddr_in {
    uint8_t sin_len;
    sa_family_t sin_family;
    in_port_t sin_port;

    struct in_addr sin_addr;
    char sin_zero[8];
};/* in_addr_t <--> uint32_t */
struct in_addr {
    in_addr_t s_addr;
};

 

posted on 2021-04-03 23:19  toughcactus  阅读(113)  评论(0编辑  收藏  举报