BSD 4_2 development
[unix-history] / usr / man / man2 / socketpair.2
CommitLineData
d4fae2ef
C
1.TH SOCKETPAIR 2 "27 July 1983"
2.UC 4
3.SH NAME
4socketpair \- create a pair of connected sockets
5.SH SYNOPSIS
6.nf
7.ft B
8#include <sys/types.h>
9#include <sys/socket.h>
10.PP
11.ft B
12socketpair(d, type, protocol, sv)
13int d, type, protocol;
14int sv[2];
15.fi
16.SH DESCRIPTION
17The
18.I socketpair
19call creates an unnamed pair of connected sockets in
20the specified domain
21.IR d ,
22of the specified
23.IR type ,
24and using the optionally specified
25.IR protocol .
26The descriptors used in referencing the new sockets
27are returned in
28.IR sv [0]
29and
30.IR sv [1].
31The two sockets are indistinguishable.
32.SH DIAGNOSTICS
33A 0 is returned if the call succeeds, \-1 if it fails.
34.SH ERRORS
35The call succeeds unless:
36.TP 20
37[EMFILE]
38Too many descriptors are in use by this process.
39.TP 20
40[EAFNOSUPPORT]
41The specified address family is not supported on this machine.
42.TP 20
43[EPROTONOSUPPORT]
44The specified protocol is not supported on this machine.
45.TP 20
46[EOPNOSUPPORT]
47The specified protocol does not support creation of socket pairs.
48.TP 20
49[EFAULT]
50The address \fIsv\fP does not specify a valid part of the
51process address space.
52.SH "SEE ALSO"
53read(2), write(2), pipe(2)
54.SH BUGS
55This call is currently implemented only for the UNIX domain.