On Sat, Mar 31, 2001 at 01:42:14AM -0600, chien-yu chen wrote:
> 1. I know pipes in linux are bi-directional.
Is this true??? You can get this effect using socketpair(2), but I'm
under the impression that pipe(2) returns a standard unidirectional pipe.
> 2. My pipes are not plumbing correctly.
You've got a sequencing problem. Both the parent and child block waiting
for input. When I changed the child to do the write before the read
(moved one line) it worked correctly.
By the way, what you are doing is extremely subject to deadlock.
Whenever you've got two processes that can block each other, you need
to take care. What happens, for instance, if you port this code whose
pipe buffer size is smaller than the message?
Rich Steven's Unix System Programming book is an awesome reference
for this sort of stuff.
--
Chip Rosenthal <[EMAIL PROTECTED]> http://www.unicom.com/
Protect your mail server against spam. http://mail-abuse.org/
Junk email is theft. There ought to be a law. http://www.cauce.org/
"That's not communication. That's gargling." -Geoffrey Nunberg
---------------------------------------------------------------------------
Send administrative requests to [EMAIL PROTECTED]