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