Protocol Not Supported
Production Risk
Check kernel module availability before using non-default protocols in production.
EPROTONOSUPPORT (errno 93) is returned by socket() when the requested protocol is not supported by the address family or is not available on the system.
- 1Requesting IPPROTO_SCTP when the sctp kernel module is not loaded
- 2Specifying an unknown protocol number
- 3Using a protocol not supported by the address family
Creating an SCTP socket without the sctp module loaded.
// SCTP socket without sctp module loaded int sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP); // Returns -1, errno = EPROTONOSUPPORT
expected output
socket: Protocol not supported (EPROTONOSUPPORT)
Fix 1
Load the kernel module for the protocol
WHEN When the protocol module is not loaded
# Load the SCTP module modprobe sctp # Verify it loaded lsmod | grep sctp
Why this works
Many protocols are loadable kernel modules; modprobe loads them without rebooting.
Fix 2
Use protocol 0 to let the kernel choose
WHEN When the specific protocol is not critical
// Let kernel choose the default protocol for the socket type int sockfd = socket(AF_INET, SOCK_STREAM, 0); // IPPROTO_TCP
Why this works
Protocol 0 selects the default protocol for the given address family and socket type.
Linux Programmer Manual socket(2)
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev