UNIX-domain sockets are generally more flexible than named pipes. Some of their advantages are:
- You can use them for more than two processes communicating (eg. a server process with potentially multiple client processes connecting);
- They are bidirectional;
- They support passing kernel-verified UID / GID credentials between processes;
- They support passing file descriptors between processes;
- They support packet and sequenced packet modes.
To use many of these features, you need to use the send()
/ recv()
family of system calls rather than write()
/ read()
.