[cs631apue] Question about pipe
ccui1 at stevens.edu
Sun Dec 16 10:36:40 EST 2012
I think the pipe file descriptor with index 1 fd is used for write and
fd is used for read. If you don't close fd in the read side, it will
block. That's why your browser will waiting for response.
Further more, I don't think you need tow pipes. One is enough. You can just
create one pipe in the parent process. Then you can use it to do
communication between parent and child.
See the example in the Book.
2012/12/16 hyan2 <hyan2 at stevens.edu>
> Hi Professor,
> I use pipe for the communication between child process and parent process
> when I implement POST response. I use two pairs pipe but I find that I must
> close the other pipe to get the right result. For example, I have two pipe
> in the child process, one is fd1 and one is fd2, if I use fd1 and
> fd2, then I must close fd1 and fd2. In the parent process, I use
> fd1 and fd2 and I must close its pairs. If I don't close those pairs
> I find my browser is waiting for result and when I terminate the server's
> process, the browser will get the right result. If I close those pairs,
> every thing is ok. I am confused about this. Could you explain this problem？
> Thank you.
> cs631apue mailing list
> cs631apue at lists.stevens.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cs631apue