Address family not supported by protocol family.
An address incompatible with the requested protocol was used. For example, you shouldn't necessarily expect to be able to use NS addresses with ARPA Internet protocols. The error occurs with the socket() function, which takes the socket type (protocol) and address family as input parameters. It also occurs with functions that take a socket handle and a sockaddr structure as input parameters. A socket already has a type (a protocol), and each sockaddr structure has an address family field to define its format. A function fails with WSAEAFNOSUPPORT if the address family referenced in sockaddr is not compatible with the referenced socket's protocol.
Since there is only one corresponding protocol for each of the datagram and datastream socket types in the Internet address family, leave the value in the protocol input parameter as socket(). Alternatively, you could call getprotobyname() or WSAAsyncGetProtoByName() to get the appropriate protocol value from the network system.