Commit | Line | Data |
---|---|---|
da268306 KB |
1 | .\" Copyright (c) 1983 The Regents of the University of California. |
2 | .\" All rights reserved. | |
2a693a1d | 3 | .\" |
da268306 KB |
4 | .\" Redistribution and use in source and binary forms are permitted |
5 | .\" provided that the above copyright notice and this paragraph are | |
6 | .\" duplicated in all such forms and that any documentation, | |
7 | .\" advertising materials, and other materials related to such | |
8 | .\" distribution and use acknowledge that the software was developed | |
9 | .\" by the University of California, Berkeley. The name of the | |
10 | .\" University may not be used to endorse or promote products derived | |
11 | .\" from this software without specific prior written permission. | |
12 | .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
13 | .\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
14 | .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
15 | .\" | |
16 | .\" @(#)socketpair.2 6.2 (Berkeley) %G% | |
2a693a1d | 17 | .\" |
bce6b55f | 18 | .TH SOCKETPAIR 2 "" |
2a693a1d KM |
19 | .UC 5 |
20 | .SH NAME | |
21 | socketpair \- create a pair of connected sockets | |
22 | .SH SYNOPSIS | |
23 | .nf | |
24 | .ft B | |
25 | #include <sys/types.h> | |
26 | #include <sys/socket.h> | |
27 | .PP | |
28 | .ft B | |
29 | socketpair(d, type, protocol, sv) | |
30 | int d, type, protocol; | |
31 | int sv[2]; | |
32 | .fi | |
33 | .SH DESCRIPTION | |
34 | The | |
35 | .I socketpair | |
36 | call creates an unnamed pair of connected sockets in | |
37 | the specified domain | |
38 | .IR d , | |
39 | of the specified | |
40 | .IR type , | |
41 | and using the optionally specified | |
42 | .IR protocol . | |
43 | The descriptors used in referencing the new sockets | |
44 | are returned in | |
45 | .IR sv [0] | |
46 | and | |
47 | .IR sv [1]. | |
48 | The two sockets are indistinguishable. | |
49 | .SH DIAGNOSTICS | |
50 | A 0 is returned if the call succeeds, \-1 if it fails. | |
51 | .SH ERRORS | |
52 | The call succeeds unless: | |
53 | .TP 20 | |
54 | [EMFILE] | |
55 | Too many descriptors are in use by this process. | |
56 | .TP 20 | |
57 | [EAFNOSUPPORT] | |
58 | The specified address family is not supported on this machine. | |
59 | .TP 20 | |
60 | [EPROTONOSUPPORT] | |
61 | The specified protocol is not supported on this machine. | |
62 | .TP 20 | |
63 | [EOPNOSUPPORT] | |
64 | The specified protocol does not support creation of socket pairs. | |
65 | .TP 20 | |
66 | [EFAULT] | |
67 | The address \fIsv\fP does not specify a valid part of the | |
68 | process address space. | |
69 | .SH "SEE ALSO" | |
70 | read(2), write(2), pipe(2) | |
71 | .SH BUGS | |
72 | This call is currently implemented only for the UNIX domain. |