2 .\" Copyright 1989 AT&T
3 .\" Copyright (C) 2002, Sun Microsystems, Inc. All Rights Reserved
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH SOCKETPAIR 3SOCKET "Jan 10, 2001"
9 socketpair \- create a pair of connected sockets
13 \fBcc\fR [ \fIflag\fR ... ] \fIfile\fR ... \fB-lsocket\fR \fB -lnsl \fR [ \fIlibrary\fR ... ]
14 #include <sys/types.h>
15 #include <sys/socket.h>
17 \fBint\fR \fBsocketpair\fR(\fBint\fR \fIdomain\fR, \fBint\fR \fItype\fR, \fBint\fR \fIprotocol\fR, \fBint\fR \fIsv\fR[2]);
23 The \fBsocketpair()\fR library call creates an unnamed pair of connected
24 sockets in the specified address family \fIdomain\fR, of the specified
25 \fItype\fR, that uses the optionally specified \fIprotocol\fR. The descriptors
26 that are used in referencing the new sockets are returned in \fIsv\fR[0] and
27 \fIsv\fR[1]. The two sockets are indistinguishable.
31 \fBsocketpair()\fR returns \fB\(mi1\fR on failure and \fB0\fR on success.
35 The call succeeds unless:
39 \fB\fBEAFNOSUPPORT\fR\fR
42 The specified address family is not supported on this machine.
51 Too many descriptors are in use by this process.
60 There was insufficient user memory for the operation to complete.
69 There were insufficient \fBSTREAMS\fR resources for the operation to complete.
75 \fB\fBEOPNOTSUPP\fR\fR
78 The specified protocol does not support creation of socket pairs.
84 \fB\fBEPROTONOSUPPORT\fR\fR
87 The specified protocol is not supported on this machine.
96 The process does not have appropriate privileges.
102 See \fBattributes\fR(5) for descriptions of the following attributes:
110 ATTRIBUTE TYPE ATTRIBUTE VALUE
118 \fBpipe\fR(2), \fBread\fR(2), \fBwrite\fR(2), \fBsocket.h\fR(3HEAD),
123 This call is currently implemented only for the \fBAF_UNIX\fR address family.