A2.1-Socket address structures

This structure is defined in <sys/socket.h>.

struct sockaddr { /* generic structure for a socket address */
    u_short sa_family; /* address family: AF_XXX value */
    char sa_data[14]; /* up to 14 bytes of protocol specific address */
};

These structures are defined in <netinet/in.h>.

struct in_addr { /* internet address */
    u_long s_addr; /* 32-bit netid/hostid, net byte order */
};
struct sockaddr_in { /* sockaddr structure for Internet */
    short sin_family; /* AF_INET */
    u_short sin_port; /* 16-bit port nb, net byte order */
    struct in_addr sin_addr; /* internet address */
    char sin_zero[8]; /* unused */
};