xref: /minix3/minix/man/man2/socketpair.2 (revision 4f89addcc198bff2fc614da2f8f4a7beb4b6cb7d)
SOCKETPAIR 2
NAME
socketpair - creates a pair of connected sockets.
SYNOPSIS
#include <sys/socket.h> int socketpair(int domain, int type, int protocol, int sv[2]);

DESCRIPTION
socketpair() 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

15 [EAFNOSUPPORT] The domain is not supported.

15 [EPROTOTYPE] The protocol is not supported by the domain.

15 [EPROTONOSUPPORT] The protocol is not supported by the type.

15 [EINVAL] The pair of sockets aren't in a valid state or are not connection oriented sockets.

15 [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 ALSO
socket(2), unix(8)
HISTORY
This function first appeared in Minix 3.1.8.