Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!security!genrad!decvax!harpo!floyd!clyde!ihnp4!zehntel!hplabs!sri-unix!moss@brl-vld From: moss@brl-vld@sri-unix.UUCP Newsgroups: net.unix Subject: Re: reading and writing to another process Message-ID: <12446@sri-arpa.UUCP> Date: Thu, 6-Oct-83 08:51:56 EDT Article-I.D.: sri-arpa.12446 Posted: Thu Oct 6 08:51:56 1983 Date-Received: Thu, 20-Oct-83 02:21:05 EDT Lines: 22 From: Gary S. Moss (301)278-6647 In practice, it is best to set up a batch operation requiring only one pipe. The parent writes to a temporary file, then forks. The child reads from that file rather than from a pipe (just substitute the file descriptor for the pipe descriptor in the fcntl(2) or dup(2) system calls). The parent, immediately after forking reads from the pipe. This way, the child does not block during reading so there is no chance for a deadlock. This does not allow a true conversation to occur because when the child hits an EOF, it will terminate, however, it is sufficient for most applications. The thing to watch out for is that a process writing on a pipe will block if the buffer gets full and nobody is reading from it. Therefore, the parent should finish writing to the child so that it can be reading from it before the child starts writing. Setting up communications protocols will not work as a solution to the original question because the child is blind to the whole thing. - Moss.