SOCKETPAIR(2)SOCKETPAIR(2)NAMEsocketpair - creates a pair of connected sockets.
SYNOPSIS
#include <sys/socket.h>
int socketpair(int domain, int type, int protocol, int sv[2]);
DESCRIPTIONsocketpair() creates two connected sockets of the specified type in the
specified domain using the specified protocol and stores the two
resulting socket descriptors in sv[2].
RETURN VALUES
On success, this function returns 0, and sv[2] is set to the two newly
created socket descriptors. On error, -1 is returned and errno is set.
ERRORS
[EAFNOSUPPORT] The domain is not supported.
[EPROTOTYPE] The protocol is not supported by the domain.
[EPROTONOSUPPORT]
The protocol is not supported by the type.
[EINVAL] The pair of sockets aren't in a valid state or are not
connection oriented sockets.
[EPERM] The user ID, group ID, and process ID of the first
socket doesn't match that of the second.
NOTES
This function is only implemented for unix domain sockets. Therefore,
the only valid value for domain is AF_UNIX
SEE ALSOsocket(2), unix(8)HISTORY
This function first appeared in Minix 3.1.8.
SOCKETPAIR(2)