SOCKADDR Structure

The SOCKADDR structure has the following form:

struct sockaddr {
    unsigned short sa_family;
    char           sa_data[14];
};

The SOCKADDR structure is used to store an Internet Protocol (IP) address for a machine participating in a Windows Sockets communication.

Members

sa_family

Socket address family.

sa_data

Maximum size of all of the different socket address structures.

Comments

The Microsoft TCP/IP Sockets Developer’s Kit only supports the Internet address domains. To actually fill in values for each part of an address, you use the SOCKADDR_IN data structure, which is specifically for this address format. The SOCKADDR and the SOCKADDR_IN data structures are the same size. You simply cast to switch between the two structure types. For more information, see in the Win32 SDK documentation.

See Also   SOCKADDR_IN, CAsyncSocket::Create, CSocket::Create