.TH socketpair() "" "" "Sockets Function (libsocket)"
.PC "Create a pair of sockets"
\fBint socketpair (\fIfamily\^\fB, \fItype\^\fB, \fIprotocol\^\fB, \fIfds\^\fB)\fR
\fBint \fIfamily\^\fB, \fItype\^\fB, \fIprotocol\^\fB, \fIfds\fB[2];\fR
.PP
Function
.B socketpair()
creates a pair of sockets.
.IR family ,
.IR type ,
and
.I protocol
give the family, type, and protocol of the sockets to be created.
At present,
.I family
must be set to
.BR AF_UNIX .
.I fds
gives the address of an array of two integers, into which
.B socketpair()
writes the file descriptors of the sockets it creates.
.PP
If all goes well,
.B socketpair()
returns zero.
If an error occurs, it returns \-1 and sets
.B errno
to an appropriate value.
.SH "See Also"
.Xr "libsocket" libsocket
.SH Notes
.B socketpair()
does not connect the pair of sockets that it creates, so a call to
.B getpeername()
on one of them will not return the name of the other.
