1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
13 .\" 3. All advertising materials mentioning features or use of this software
14 .\" must display the following acknowledgement:
15 .\" This product includes software developed by the University of
16 .\" California, Berkeley and its contributors.
17 .\" 4. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .\" @(#)socketpair.2 6.4 (Berkeley) 3/10/91
36 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
37 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
38 .\" Modified 2002-07-22 by Michael Kerrisk <mtk.manpages@gmail.com>
39 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
40 .\" 2008-10-11, mtk: Add description of SOCK_NONBLOCK and SOCK_CLOEXEC
42 .TH SOCKETPAIR 2 2008-10-11 "Linux" "Linux Programmer's Manual"
44 socketpair \- create a pair of connected sockets
46 .BR "#include <sys/types.h>" " /* See NOTES */"
48 .B #include <sys/socket.h>
50 .BI "int socketpair(int " domain ", int " type ", int " protocol \
55 call creates an unnamed pair of connected sockets in the specified
59 and using the optionally specified
61 For further details of these arguments, see
64 The descriptors used in referencing the new sockets are returned in
68 The two sockets are indistinguishable.
70 On success, zero is returned.
71 On error, \-1 is returned, and
77 The specified address family is not supported on this machine.
82 does not specify a valid part of the process address space.
85 Too many descriptors are in use by this process.
88 The system limit on the total number of open files has been reached.
91 The specified protocol does not support creation of socket pairs.
94 The specified protocol is not supported on this machine.
99 function call appeared in 4.2BSD.
100 It is generally portable to/from
101 non-BSD systems supporting clones of the BSD socket layer (including
104 On Linux, the only supported domain for this call is
108 (Most implementations have the same restriction.)
119 POSIX.1-2001 does not require the inclusion of
121 and this header file is not required on Linux.
122 However, some historical (BSD) implementations required this header
123 file, and portable applications are probably wise to include it.
132 This page is part of release 3.67 of the Linux
135 A description of the project,
136 information about reporting bugs,
137 and the latest version of this page,
139 \%http://www.kernel.org/doc/man\-pages/.