views:

344

answers:

1

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 like SCM_RIGHTS and SCM_CREDENTIALS can be passed over them.

In the kernel, pipes are implemented in the filesystem code and socketpairs in the networking code.

caf
I think also socketpairs support partial reads and pipes don't.
poolie