socketpair(2) System Calls Manual socketpair(2) socketpair - C (libc, -lc) #include int socketpair(int domain, int type, int protocol, int sv[2]); socketpair() domain type, ( ) protocol. socket(2). The file descriptors used in referencing the new sockets are returned in sv[0] and sv[1]. The two sockets are indistinguishable. On success, zero is returned. On error, -1 is returned, errno is set to indicate the error, and sv is left unchanged On Linux (and other systems), socketpair() does not modify sv on failure. A requirement standardizing this behavior was added in POSIX.1-2008 TC2. EAFNOSUPPORT . EFAULT sv . EMFILE . ENFILE . EOPNOTSUPP . EPROTONOSUPPORT . Linux AF_UNIX ( AF_LOCAL) AF_TIPC ( Linux 4.12). POSIX.1-2008. POSIX.1-2001, 4.4BSD. socketpair() first appeared in 4.2BSD. It is generally portable to/from non-BSD systems supporting clones of the BSD socket layer (including System V variants). Linux 2.6.27, type socketpair() SOCK_NONBLOCK SOCK_CLOEXEC, socket(2). pipe(2), read(2), socket(2), write(2), socket(7), unix(7) () Alexander Golubev , Azamat Hackimov , Hotellook, Nikita , Spiros Georgaras , Vladislav , Yuri Kozlov ; GNU (GNU General Public License - GPL, 3 ) , - . - , , () () () <>. Linux 6.9.1 2 2024 . socketpair(2)