PREV UP next C++ socket classes for OS/2

1.6.8: upipestream classes

The classes uipipestream, uopipestream, and uiopipestream are stream classes that read, write, and read/write from a pair of unnamed pipes.

The standard constructors for these classes take a parameter of type const char * command. When you use this versions, a sub-process is created to read/write the other end of the pipe through the standard input/output of the sub-process. The process id of this spawn process can be obtained using operator IProcessId ().

There are non-standard constructors that do not take a command parameter. When these are used the caller is responsible for doing IO to the other end of the pipe. The other end of the pipe can be obtained using the function other_input_handle() or other_output_handle().

The class uiopipestream has two pairs of unnamed pipes, because it does both input and output. Extreme care should be used when using this class to insure that a deadlock does not occur. Deadlock could occur (for example) if the software at each end of the pipe is waiting for input from the other. Remember that stream buffering means that output does not necessarily occur immediately when a stream is written.