int socketpair(d, type, protocol, sv)
int d, type, protocol;
int sv[2];
Description
The
socketpair( )
call creates an unnamed pair of connected sockets
in the specified address family d
(currently only the AF_UNIX family is supported).
The type may be specified as either
SOCK_STREAM or SOCK_DGRAM.
Because there are no protocol families associated
with UNIX domain sockets,
the only valid value for protocol is zero.
The descriptors used in referencing the new sockets
are returned in sv[0] and sv[1].
The two sockets are indistinguishable.
Return values
socketpair( )
returns 0 on success.
Upon failure,
socketpair( )
returns -1 and sets errno to indicate the error.