What does errno 97 (EAFNOSUPPORT) mean?

 
Could be also:
ConstantTypeOS
ENOLINKerrnoMac
EMSGSIZEerrnoSolaris
HAL1_INITIALIZATION_FAILEDBugCheck CodeWindows
Previous Next
EDESTADDRREQ ENOLINK

EAFNOSUPPORT

EAFNOSUPPORT points to an address-family problem, not a remote service outage. The family chosen for the socket or supplied address is unavailable or unsuitable: for example, code creates an IPv4 socket but passes an IPv6 sockaddr, or the operating environment has no support for the selected family.

The failure can occur in socket(), bind(), or connect(). Applications that use getaddrinfo() should preserve its returned address family, socket type, protocol, and address length together; constructing a different socket manually is a common source of mismatch. Containers and restricted network namespaces may expose fewer protocol families than the host.

How to diagnose it

  • Record the requested AF_* family, socket type, protocol number, and the sa_family stored in the address structure.
  • Verify that the address buffer has the correct structure and length for that family.
  • When dual-stack support is intended, resolve and try compatible IPv6 and IPv4 candidates rather than forcing one family.

POSIX socket() · POSIX bind() · Linux socket(2)


Looking for a different code? Search another status or error code.