1 .\" Copyright (c) 1983, 1991 The Regents of the University of California.
2 .\" All rights reserved.
4 .\" SPDX-License-Identifier: BSD-4-Clause-UC
6 .\" @(#)socketpair.2 6.4 (Berkeley) 3/10/91
8 .\" Modified 1993-07-24 by Rik Faith <faith@cs.unc.edu>
9 .\" Modified 1996-10-22 by Eric S. Raymond <esr@thyrsus.com>
10 .\" Modified 2002-07-22 by Michael Kerrisk <mtk.manpages@gmail.com>
11 .\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
12 .\" 2008-10-11, mtk: Add description of SOCK_NONBLOCK and SOCK_CLOEXEC
14 .TH SOCKETPAIR 2 2021-03-22 "Linux" "Linux Programmer's Manual"
16 socketpair \- create a pair of connected sockets
19 .RI ( libc ", " \-lc )
22 .B #include <sys/socket.h>
24 .BI "int socketpair(int " domain ", int " type ", int " protocol \
30 call creates an unnamed pair of connected sockets in the specified
34 and using the optionally specified
36 For further details of these arguments, see
39 The file descriptors used in referencing the new sockets are returned in
43 The two sockets are indistinguishable.
45 On success, zero is returned.
46 On error, \-1 is returned,
48 is set to indicate the error, and
52 On Linux (and other systems),
57 A requirement standardizing this behavior was added in POSIX.1-2008 TC2.
58 .\" http://austingroupbugs.net/view.php?id=483
62 The specified address family is not supported on this machine.
67 does not specify a valid part of the process address space.
70 The per-process limit on the number of open file descriptors has been reached.
73 The system-wide limit on the total number of open files has been reached.
76 The specified protocol does not support creation of socket pairs.
79 The specified protocol is not supported on this machine.
81 POSIX.1-2001, POSIX.1-2008, 4.4BSD.
83 first appeared in 4.2BSD.
84 It is generally portable to/from
85 non-BSD systems supporting clones of the BSD socket layer (including
88 On Linux, the only supported domains for this call are
94 .\" commit: 70b03759e9ecfae400605fa34f3d7154cccbbba3
105 argument, as described in