Pipes don't work that way. If both processes want to read AND write, you need two pipes, one for the parent sending data to the child, one for the child sending data to the parent. Or use a socket instead of a pipe.