NAME | SYNOPSIS | FEATURES | DESCRIPTION | DIAGNOSTICS | ERRORS | ATTRIBUTES | SEE ALSO | BUGS | HISTORY
#include <sys/types.h> #include <sys/socket.h>int socketpair(int d, int type, int protocol, int *sv);
POSIX_SOCKETS
The socketpair call creates an unnamed pair of connected sockets in the domain specified by d, of the type specified, and using the optionally specified protocol. The descriptors used in referencing the new sockets are returned in sv[0] and sv[1]. The two sockets are indistinguishable.
If successful, socketpair returns a value of 0; otherwise it returns a value of -1, and sets errno to indicate one of the following error conditions.
Too many descriptors are in use by this process.
The system file table is full.
Insufficient buffer space is available. The operation cannot be completed until sufficient resources are freed.
The address family specified is not supported on this machine.
The protocol specified is not supported on this machine.
The protocol specified does not support creation of socket pairs.
The address sv does not specify a valid part of the process address space.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
This call is only currently implemented for the UNIX domain.
This function call appeared in 4.2 BSD.
NAME | SYNOPSIS | FEATURES | DESCRIPTION | DIAGNOSTICS | ERRORS | ATTRIBUTES | SEE ALSO | BUGS | HISTORY