CS631 -- Advanced Programming in the UNIX Environment
Pipes Exercise: Bi-directional communications using pipe(2)
As discussed and illustrated by the code examples, pipes are uni-directional, but socketpairs are bi-directional. However, you can, of course, facilitate bi-directional communications using pipes simply by creating two pipes before forking the child process.
Using that approach, rewrite the socketpair.c example to use a pair of pipe(2)s.