| Previous | Next |
| WSAEPFNOSUPPORT | WSAEADDRINUSE |
WSAEAFNOSUPPORT
WSAEAFNOSUPPORT indicates an address-family mismatch. The socket may have been created successfully, but the address later supplied to connect, bind, sendto, or a similar call belongs to a family that cannot be used with that socket.
A common IPv4/IPv6 failure
An IPv4 socket expects an IPv4 sockaddr_in; an IPv6 socket expects sockaddr_in6. Passing the wrong structure, copying an address without preserving its family, or using a stale cached endpoint after changing resolver policy can produce this code. It differs from WSAEPFNOSUPPORT: the latter concerns availability of a protocol family, while this error concerns the particular address supplied to a socket.
What to log
- The socket's creation family, the
sa_familyof the address, and the exact structure length. - Whether name resolution returned IPv4, IPv6, or both, and how the chosen result was matched to the socket.
- Dual-stack policy and any
IPV6_V6ONLYassumptions in the application.
Microsoft: connect · Microsoft: GetAddrInfo · The Open Group: socket address families
Looking for a different code? Search another status or error code.