1SOCKETPAIR(2)                 System Calls Manual                SOCKETPAIR(2)
2
3
4

NAME

6       socketpair - create a pair of connected sockets
7

SYNOPSIS

9       #include <sys/types.h>
10       #include <sys/socket.h>
11
12       socketpair(d, type, protocol, sv)
13       int d, type, protocol;
14       int sv[2];
15

DESCRIPTION

17       The socketpair call creates an unnamed pair of connected sockets in the
18       specified domain d, of the specified type,  and  using  the  optionally
19       specified  protocol.  The descriptors used in referencing the new sock‐
20       ets are returned in sv[0] and sv[1].  The  two  sockets  are  indistin‐
21       guishable.
22

DIAGNOSTICS

24       A 0 is returned if the call succeeds, -1 if it fails.
25

ERRORS

27       The call succeeds unless:
28
29       [EMFILE]            Too many descriptors are in use by this process.
30
31       [EAFNOSUPPORT]      The  specified  address  family is not supported on
32                           this machine.
33
34       [EPROTONOSUPPORT]   The specified protocol is  not  supported  on  this
35                           machine.
36
37       [EOPNOSUPPORT]      The specified protocol does not support creation of
38                           socket pairs.
39
40       [EFAULT]            The address sv does not specify a valid part of the
41                           process address space.
42

SEE ALSO

44       read(2), write(2), pipe(2)
45

BUGS

47       This call is currently implemented only for the UNIX domain.
48
49
50
514.2 Berkeley Distribution        May 15, 1985                    SOCKETPAIR(2)
Impressum