1SOCKETPAIR(2)              Linux Programmer's 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       int socketpair(int d, int type, int protocol, int sv[2]);
13

DESCRIPTION

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

RETURN VALUE

22       On  success,  zero is returned.  On error, -1 is returned, and errno is
23       set appropriately.
24

ERRORS

26       EAFNOSUPPORT
27              The specified address family is not supported on this machine.
28
29       EFAULT The address sv does not specify a  valid  part  of  the  process
30              address space.
31
32       EMFILE Too many descriptors are in use by this process.
33
34       ENFILE The  system  limit  on  the  total number of open files has been
35              reached.
36
37       EOPNOTSUPP
38              The specified protocol  does  not  support  creation  of  socket
39              pairs.
40
41       EPROTONOSUPPORT
42              The specified protocol is not supported on this machine.
43

CONFORMING TO

45       4.4BSD,  POSIX.1-2001.   The  socketpair()  function  call  appeared in
46       4.2BSD. It is generally portable  to/from  non-BSD  systems  supporting
47       clones of the BSD socket layer (including System V variants).
48

NOTES

50       On  Linux,  the only supported domain for this call is AF_UNIX (or syn‐
51       onymously, AF_LOCAL).  (Most implementations  have  the  same  restric‐
52       tion.)
53

SEE ALSO

55       pipe(2), read(2), socket(2), write(2), unix(7)
56
57
58
59Linux 2.6.7                       2004-06-17                     SOCKETPAIR(2)
Impressum