PreviousNext

Pipes

IDL supports pipes as a mechanism for transferring large quantities of typed data. An IDL pipe is an open-ended sequence of elements of one type. A pipe permits application-level optimization of bulk data transfer by allowing the overlap of communication and processing. Applications that process a stream of data as it arrives, rather than simply storing the data in memory, can make efficient use of the pipe mechanism.

A pipe is specified as follows:

pipe type_specifier

The type_specifier specifies the type for the elements of the pipe. This type cannot be a pointer type, a type that contains a pointer, a conformant type, a context handle, a handle_t element type, or a data type that is declared as transmit_as.

A pipe type can be used to declare only the type of an operation parameter. IDL recognizes three kinds of pipes, based on the three operation parameters:

· An in pipe is for transferring data from a client to a server. It allows the callee (server) to pull an open-ended stream of typed data from the caller (client).

· An out pipe is for transferring data from a server to a client. It allows the callee (server) to push the stream of data to the caller (client).

· An in,out pipe provides for two-way data transfer between a client and server by combining the behavior of in and out pipes.

A pipe can be defined only through a typedef declaration. Anonymous pipe types are not supported.

At the interface between the stub and the application-specific code (for both the client and server), a pipe appears as a simple callback mechanism. To the user code, the processing of a pipe parameter appears to be synchronous. The IDL implementation of pipes in the RPC stub and runtime allows the apparent callbacks to occur without requiring actual remote callbacks. As a result, pipes provide an efficient transfer mechanism for large amounts of data.

Note however, that pipe data communications occur at about the same speed as arrays. Pipes can improve latency and minimum memory utilization, but not throughput. Pipes are intended for use where the receiver can process the data in some way as it arrives, for example by writing it to a file or passing it to a consumer thread. If the intent is to store the data in memory for later processing, pipes offer no advantage over arrays.

More:

IDL Pipes Example

Rules for Using Pipes