I would like to know not only user-side differences, but differences / common parts in Linux kernel implementation as well.
+3
A:
pipes are unidirectional, so you need two pipes to have bidirectional communication, whereas a socketpair is bidirectional.
pipes are always stream-oriented, whereas socketpairs can be datagram-oriented.
socketpairs are normal
AF_UNIX
sockets, which means that ancillary messages likeSCM_RIGHTS
andSCM_CREDENTIALS
can be passed over them.
In the kernel, pipes are implemented in the filesystem code and socketpairs in the networking code.
caf
2009-10-19 21:44:46
I think also socketpairs support partial reads and pipes don't.
poolie
2010-06-07 05:53:38