socketpair(2)
NAME
socketpair − create a pair of connected sockets
SYNOPSIS
#include <sys/socket.h>
int socketpair(int af, int type, int protocol, int sv[2]);
DESCRIPTION
socketpair() creates an unnamed pair of connected sockets and returns two file descriptors in sv[0] and sv[1]. The two sockets are indistinguishable. af specifies the address family. See socket(2). type specifies the semantics of communication for the socket. protocol specifies a particular protocol to be used. protocol can be supplied as zero, in which case the system chooses a protocol type to use.
RETURN VALUES
Upon successful completion, socketpair() returns 0; otherwise, it returns −1 and sets errno to indicate the error.
ERRORS
socketpair() fails if any of the following conditions are encountered:
[EMFILE] The per-process file descriptor table is full.
[ENFILE] The system file table is temporarily full.
[EAFNOSUPPORT] The specified address family is not supported in this version of the system.
[EPROTONOSUPPORT] The specified protocol is not supported in this version of the system.
[EOPNOSUPPORT] The specified protocol does not support creation of socket pairs.
[EFAULT] The sv parameter is not valid.
[ENOBUFS] Insufficient resources were available in the system to perform the operation.
DEPENDENCIES
This call is supported only for AF_UNIX.
AUTHOR
socketpair() was developed by the University of California, Berkeley.
SEE ALSO
read(2), write(2), socket(2) .
Hewlett-Packard Company — HP-UX Release 9.0: August 1992