Unix domain socket
Encyclopedia
A Unix domain socket or IPC socket (inter-process communication
socket) is a data communications endpoint for exchanging data between processes executing within the same host operating system. While similar in functionality to
named pipe
s, Unix domain sockets may be created as byte stream
s or as datagram
sequences, while pipes are byte streams only. Processes using Unix domain sockets do not need to share a common ancestry. The programmer's application interface (API) for Unix domain sockets is similar to that of an Internet socket
, but does not use an underlying network protocol for communication. The Unix domain socket facility is a standard component of POSIX
operating system
s.
Unix domain sockets use the file system as address name space
. They are referenced by processes as inodes in the file system. This allows two processes to open the same socket in order to communicate. However, communication occurs entirely within the operating system kernel.
In addition to sending data, processes may send file descriptor
s across a Unix domain socket connection using the
Inter-process communication
In computing, Inter-process communication is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared...
socket) is a data communications endpoint for exchanging data between processes executing within the same host operating system. While similar in functionality to
named pipe
Named pipe
In computing, a named pipe is an extension to the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication. The concept is also found in Microsoft Windows, although the semantics differ substantially...
s, Unix domain sockets may be created as byte stream
Byte stream
In computer science, a byte stream is a bit stream, in which data bits are grouped into units, called bytes.In computer networking the term octet stream is sometimes used to refer to the same thing; it emphasizes the use of bytes having the length of 8 bits, known as octets.Formally, a byte stream...
s or as datagram
Datagram
A datagram is a basic transfer unit associated with a packet-switched network in which the delivery, arrival time, and order are not guaranteed....
sequences, while pipes are byte streams only. Processes using Unix domain sockets do not need to share a common ancestry. The programmer's application interface (API) for Unix domain sockets is similar to that of an Internet socket
Internet socket
In computer networking, an Internet socket or network socket is an endpoint of a bidirectional inter-process communication flow across an Internet Protocol-based computer network, such as the Internet....
, but does not use an underlying network protocol for communication. The Unix domain socket facility is a standard component of POSIX
POSIX
POSIX , an acronym for "Portable Operating System Interface", is a family of standards specified by the IEEE for maintaining compatibility between operating systems...
operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...
s.
Unix domain sockets use the file system as address name space
Namespace (computer science)
A namespace is an abstract container or environment created to hold a logical grouping of unique identifiers or symbols . An identifier defined in a namespace is associated only with that namespace. The same identifier can be independently defined in multiple namespaces...
. They are referenced by processes as inodes in the file system. This allows two processes to open the same socket in order to communicate. However, communication occurs entirely within the operating system kernel.
In addition to sending data, processes may send file descriptor
File descriptor
In computer programming, a file descriptor is an abstract indicator for accessing a file. The term is generally used in POSIX operating systems...
s across a Unix domain socket connection using the
sendmsg
and recvmsg
system calls.See also
- Raw socketRaw socketIn computer networking, a raw socket is a socket that allows direct sending and receiving of network packets by applications, bypassing all encapsulation in the networking software of the operating system. Most socket application programming interfaces , especially those based on Berkeley sockets,...
- Datagram socketDatagram socketA datagram socket is a type of connectionless Internet socket, which is the sending or receiving point for packet delivery services. Each packet sent or received on a datagram socket is individually addressed and routed...
- Stream socketStream socketIn computer networking, a stream socket is a type of internet socket which provides a connection-oriented, sequenced, and unduplicated flow of data without record boundaries, with well-defined mechanisms for creating and destroying connections and for detecting errors.This internet socket type...
- Internet socketInternet socketIn computer networking, an Internet socket or network socket is an endpoint of a bidirectional inter-process communication flow across an Internet Protocol-based computer network, such as the Internet....
- Berkeley socketsBerkeley socketsThe Berkeley sockets application programming interface comprises a library for developing applications in the C programming language that perform inter-process communication, most commonly for communications across a computer network....
- Pipeline (Unix)Pipeline (Unix)In Unix-like computer operating systems , a pipeline is the original software pipeline: a set of processes chained by their standard streams, so that the output of each process feeds directly as input to the next one. Each connection is implemented by an anonymous pipe...
External links
- ucspi-unix, UNIX-domain socket client-server command-line tools
- unix domain sockets guide
- another unix domain sockets guide
- Unix sockets vs Internet sockets
- Unix Domain Sockets for Java