Go to the previous, next section.
int socket(int domain, int type, int protocol);
domain: [in] the protocol family of the socket.
type: [in] its type.
protocol: [in] the protocol used for communications.
Creates a communication endpoint. The domain parameter can take the following values:
AF_UNIX
AF_INET
AF_ISO
AF_NS
AF_IMPLINK
As of version 1.0 of Linux: AF_ISO
, AF_IMPLINK
and
AF_NS
are not supported.
The type parameter may take the following values:
SOCK_STREAM
SOCK_DGRAM
SOCK_RAW
SOCK_SEQPACKET
AF_NS
domain.
SOCK_RDM
The SOCK_STREAM
type provide reliable transmission. Even when the
connection is not transmitting usefull information, a packet is send at
a regular interval to ensure that the connection is still intact.
On success, a new file descriptor for the socket is returned. On error,
-1 is returned and errno
is set to one of the following values:
EACCESS
: the calling task does not have permission to
create a socket of the specified domain, type and protocol.
EPROTONOSUPPORT
, EMFILE
, ENFILE
or ENOBUFFS
.
Go to the previous, next section.