1socketpair(3SOCKET)        Sockets Library Functions       socketpair(3SOCKET)
2
3
4

NAME

6       socketpair - create a pair of connected sockets
7

SYNOPSIS

9       cc [ flag ... ] file ... -lsocket  -lnsl  [ library ... ]
10       #include <sys/types.h>
11       #include <sys/socket.h>
12
13       int socketpair(int domain, int type, int protocol, int sv[2]);
14
15

DESCRIPTION

17       The  socketpair()  library  call  creates  an unnamed pair of connected
18       sockets in the specified address family domain, of the specified  type,
19       that  uses  the optionally specified protocol. The descriptors that are
20       used in referencing the new sockets are returned in  sv[0]  and  sv[1].
21       The two sockets are indistinguishable.
22

RETURN VALUES

24       socketpair() returns −1 on failure and 0 on success.
25

ERRORS

27       The call succeeds unless:
28
29       EAFNOSUPPORT       The  specified  address  family  is not supported on
30                          this machine.
31
32
33       EMFILE             Too many descriptors are in use by this process.
34
35
36       ENOMEM             There was insufficient user memory for the operation
37                          to complete.
38
39
40       ENOSR              There  were  insufficient  STREAMS resources for the
41                          operation to complete.
42
43
44       EOPNOTSUPP         The specified protocol does not support creation  of
45                          socket pairs.
46
47
48       EPROTONOSUPPORT    The  specified  protocol  is  not  supported on this
49                          machine.
50
51
52       EACCES             The process does not have appropriate privileges.
53
54

ATTRIBUTES

56       See attributes(5) for descriptions of the following attributes:
57
58
59
60
61       ┌─────────────────────────────┬─────────────────────────────┐
62       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
63       ├─────────────────────────────┼─────────────────────────────┤
64       │MT-Level                     │Safe                         │
65       └─────────────────────────────┴─────────────────────────────┘
66

SEE ALSO

68       pipe(2), read(2), write(2), socket.h(3HEAD), attributes(5)
69

NOTES

71       This call is currently implemented only for the AF_UNIX address family.
72
73
74
75SunOS 5.11                        10 Jan 2001              socketpair(3SOCKET)
Impressum