| Previous | Next |
| EADDRNOTAVAIL | EALREADY |
EAFNOSUPPORT
EAFNOSUPPORT signals an address-family mismatch. It is about the family encoded in an address or requested by the caller, such as IPv4 versus IPv6, not about whether a hostname resolves. A socket can be valid while the supplied sockaddr, protocol provider, or option is incompatible with that socket's family.
Winsock applications should obtain the native WSAEAFNOSUPPORT value through WSAGetLastError(). This UCRT constant is meaningful when a POSIX-oriented wrapper translates the error; it should not replace the original Winsock status in logs.
Checks that locate the mismatch
- Log the family passed to
socket, the socket type and protocol, and thesa_familyembedded in every address structure. - Validate address-structure size and initialization; an incorrectly cast or partially initialized structure can look like an unsupported family.
- For dual-stack code, record the IPv6-only setting and resolve whether the application expects IPv4-mapped addresses.
- Do not repair the failure by changing only the port or host string; the family decision occurs before those values become meaningful.
References
Looking for a different code? Search another status or error code.