1.1.24.5 socket

C

int socket(int domain, int type, int protocol)

Description

Create an endpoint for communication.

Parameters

ParametersDescription
domainCommunication domain, must be AF_INET or AF_INET6.
typeSocket type, must be SOCK_STREAM or SOCK_DGRAM.
protocolSpecific socket protocol, should be zero or IPPROTO_TLS.

Returns

Socket file descriptor or -1 for error (errno set).

Remarks

errnoDescription
EAFNOSUPPORTThe implementation does not support the specified address family.
EINVALUnknown protocol, or protocol family not available.
EPROTONOSUPPORTThe protocol type or the specified protocol is not supported within this domain.
EFAULTSystem fault
ENFILEThe system-wide limit on the total number of open files has been reached.
ENOMEMInsufficient memory is available. The socket cannot be created until sufficient resources are freed.
EBADMSGBad message.