Whats the different between IPC and Unix domain sockets and named pipes?
I got vague definitions from various books but couldn't get clarity on which one should be used where.
Whats the different between IPC and Unix domain sockets and named pipes?
I got vague definitions from various books but couldn't get clarity on which one should be used where.
IPC stands for Inter-Process Communications. UNIX domain sockets and named pipes are just two IPC mechanisms, described in Wikipedia:
As qrdl stated, UNIX-domain sockets and named pipes are both IPC mechanisms.
Of these two, named pipes are simpler to work with, but much less flexible than UNIX-domain sockets. For example, if you potentially expect more than one reading process for each writing process, then UNIX-domain sockets are a must; if you expect the reading process to stop and start during the execution of the writing process, then you'll need UNIX-domain sockets.
Thanks for focusing to the question, few updated features:
In Domain sockets, actual communication (the data exchange) does not use the file system, but buffers in kernel memory. By default, it is full-duplex mode.
Named pipes are identified by their access point, a file kept on the file system for handling the data. A named pipe by default supports blocked read and write operations. However, it is possible to make named pipes support non-blocking operations by specifying the O_NONBLOCK flag while opening them. A named pipe must be opened either read-only or write-only. It must not be opened for read-write because it is half-duplex,a one-way channel.
Just about any way two process communicate with each other could be considered a form of IPC.
For example: