78 lines
1.8 KiB
Plaintext
78 lines
1.8 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3n.socketpair @(#)socketpair 40.11 of 5/17/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} socketpair 3N "" "\&"
|
|
.if \nX=1 .ds x} socketpair 3N ""
|
|
.if \nX=2 .ds x} socketpair 3N "" "\&"
|
|
.if \nX=3 .ds x} socketpair "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4socketpair\fP \- create a pair of connected sockets
|
|
.SH SYNOPSIS
|
|
.nf
|
|
.ft 4
|
|
#include <sys/types.h>
|
|
#include <sys/socket.h>
|
|
.P
|
|
.ft 4
|
|
int socketpair(int d, int type, int protocol, int sv[2]);
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.P
|
|
The \f4socketpair\fP library call creates an unnamed pair of
|
|
connected sockets in the specified address family
|
|
\f2d\fP,
|
|
of the specified
|
|
\f2type\fP,
|
|
and using the optionally specified
|
|
\f2protocol\fP.
|
|
The descriptors used in referencing the new sockets
|
|
are returned in
|
|
\f2sv\fP[0]
|
|
and
|
|
\f2sv\fP[1].
|
|
The two sockets are indistinguishable.
|
|
.SH RETURN VALUE
|
|
.P
|
|
\f4socketpair\fP returns a \-1 on failure, otherwise it returns the
|
|
number of the second file descriptor it creates.
|
|
.SH ERRORS
|
|
.P
|
|
The call succeeds unless:
|
|
.TP 20
|
|
\f4EMFILE\f1
|
|
Too many descriptors are in use by this process.
|
|
.TP
|
|
\f4EAFNOSUPPORT\f1
|
|
The specified address family is not supported on this machine.
|
|
.TP
|
|
\f4EPROTONOSUPPORT\f1
|
|
The specified protocol is not supported on this machine.
|
|
.TP
|
|
\f4EOPNOSUPPORT\f1
|
|
The specified protocol does not support creation of socket pairs.
|
|
.\".TP
|
|
.\"\f4EFAULT\f1
|
|
.\"The address
|
|
.\".I sv
|
|
.\"does not specify a valid part of the
|
|
.\"process address space.
|
|
.TP
|
|
\f4ENOMEM\f1
|
|
There was insufficient user memory for the operation to complete.
|
|
.TP
|
|
\f4ENOSR\f1
|
|
There were insufficient
|
|
STREAMS
|
|
resources for the operation to
|
|
complete.
|
|
.SH "SEE ALSO"
|
|
\f4pipe\fP(2),
|
|
\f4read\fP(2),
|
|
\f4write\fP(2)
|
|
.SH NOTES
|
|
This call is currently implemented only for the \f4AF_UNIX\f1
|
|
address family.
|