Unix domain socket
A Unix domain socket aka UDS or IPC socket (inter-process communication socket) is a data communications endpoint for exchanging data between processes executing on the same host operating system. It is also referred to by its address family AF_UNIX
.
Sockets
Valid socket types in the UNIX domain are:[1]
SOCK_STREAM
(compare to TCP) – for a stream-oriented socketSOCK_DGRAM
(compare to UDP) – for a datagram-oriented socket that preserves message boundaries (as on most UNIX implementations, UNIX domain datagram sockets are always reliable and don't reorder datagrams)SOCK_SEQPACKET
(compare to SCTP) – for a sequenced-packet socket that is connection-oriented, preserves message boundaries, and delivers messages in the order that they were sent
The Unix domain socket facility is a standard component of POSIX operating systems.
The API for Unix domain sockets is similar to that of an Internet socket, but rather than using an underlying network protocol, all communication occurs entirely within the operating system kernel. Unix domain sockets may use the file system as their address name space. (Some operating systems, like Linux, offer additional namespaces.) Processes reference Unix domain sockets as file system inodes, so two processes can communicate by opening the same socket.
In addition to sending data, processes may send file descriptors across a Unix domain socket connection using the sendmsg()
and recvmsg()
system calls. This allows the sending processes to grant the receiving process access to a file descriptor for which the receiving process otherwise does not have access.[2][3] This can be used to implement a rudimentary form of capability-based security.[4]
See also
References
- ↑ "Linux Programmer's Manual (unix - sockets for local interprocess communication)". 30 April 2018. http://man7.org/linux/man-pages/man7/unix.7.html.
- ↑ "Archive of the "Postfix Discussions" mailing list". 30 September 2000. http://archives.neohapsis.com/archives/postfix/2000-09/1476.html.
- ↑ "Linux man page - cmsg(3): access ancillary data". https://linux.die.net/man/3/cmsg.
- ↑ ""Secure Programming for Linux and Unix HOWTO", Section 3.4 "Sockets and Network Connections"". David A. Wheeler. 22 August 2004. https://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/sockets.html.
External links
- The Single UNIX Specification, Issue 7 from The Open Group – System Interfaces Reference,
- The Single UNIX Specification, Issue 7 from The Open Group – System Interfaces Reference,
- The Single UNIX Specification, Issue 7 from The Open Group – System Interfaces Reference,
- Linux Programmer's Manual – Library Functions –
- ucspi-unix, UNIX-domain socket client-server command-line tools
- Unix sockets vs Internet sockets
- Unix Sockets - Beej's Guide to Unix IPC
fr:Berkeley sockets#Socket unix
![]() | Original source: https://en.wikipedia.org/wiki/Unix domain socket.
Read more |