ESOCKTNOSUPPORT
Linux / POSIXERRORCommonNetworkHIGH confidence

Socket Type Not Supported

Production Risk

Programming error; verify address family and socket type compatibility.

What this means

ESOCKTNOSUPPORT (errno 94) is returned by socket() when the requested socket type is not supported by the address family.

Why it happens
  1. 1Creating SOCK_SEQPACKET with AF_INET (not supported)
  2. 2Combining an unsupported socket type with the address family
How to reproduce

socket() with an unsupported type for the address family.

trigger — this will error
trigger — this will error
// SOCK_SEQPACKET not supported for AF_INET
int sockfd = socket(AF_INET, SOCK_SEQPACKET, 0);
// Returns -1, errno = ESOCKTNOSUPPORT

expected output

socket: Socket type not supported (ESOCKTNOSUPPORT)

Fix

Use a supported socket type for the address family

WHEN When ESOCKTNOSUPPORT is returned

Use a supported socket type for the address family
// AF_INET supports SOCK_STREAM and SOCK_DGRAM
int tcp = socket(AF_INET, SOCK_STREAM, 0);
int udp = socket(AF_INET, SOCK_DGRAM, 0);
// SOCK_SEQPACKET works with AF_UNIX or AF_TIPC
int seq = socket(AF_UNIX, SOCK_SEQPACKET, 0);

Why this works

Check the address family documentation for supported socket types.

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