EPFNOSUPPORT
Linux / POSIXERRORCommonNetworkHIGH confidence

Protocol Family Not Supported

Production Risk

Rare on modern systems; exotic protocol families require additional kernel modules.

What this means

EPFNOSUPPORT (errno 96) is returned by socket() when the requested protocol family is not supported by the kernel.

Why it happens
  1. 1Requesting AF_IPX or AF_APPLETALK without the corresponding kernel module
  2. 2Using an unsupported or unknown address family constant
How to reproduce

socket() with an unsupported protocol family.

trigger — this will error
trigger — this will error
// AF_IPX without ipx module loaded
int sockfd = socket(AF_IPX, SOCK_DGRAM, 0);
// Returns -1, errno = EPFNOSUPPORT

expected output

socket: Protocol family not supported (EPFNOSUPPORT)

Fix

Use a standard protocol family

WHEN When the exotic protocol family is not needed

Use a standard protocol family
// Use AF_INET (IPv4) or AF_INET6 (IPv6) instead
int sockfd = socket(AF_INET6, SOCK_STREAM, 0);

Why this works

AF_INET and AF_INET6 are always available. Exotic families require kernel module support.

Sources
Official documentation ↗

Linux Programmer Manual socket(2)

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Linux / POSIX errors