Named Pipe Wrapper for Win32 Platforms

Environment: VC6/MFC , Win9X/WinME/NT40/W2k

Background

Using pipes is not too complicated on WindowsNT platforms, but on Win9X it4s not that easy because named pipes are not supported.

The wrapper

"cPipe" is a C++ wrapper class encapsulating named pipes, providing a simple interface to create named pipes and to perform read/write operations. In addition an application-defined callback function, which is called by the framework if data is available, can be specified on creation ( the server side of the sample demonstrates the usage of the callback function ).

"cPipe" contains the following public methods, fully documented within the source.

Method

Description

Create

Creates and registers the neccessary pipe(s).

Close

Closes the pipe(s).

ReadPipe

Performs read operation on the pipe.

WritePipe

Performs write operation on the pipe.

GetLastError

Returns the latest cPipe error code.

The sample

The sample provides two tiny applications to demonstrate IPC. For the server-side run "core.exe" and for the client-side run "client.exe". For demonstration the server side just mirrors the data sent by the client application. I tested the sample applications on the following platforms: Win98, NT 4.0, W2k.

Server

Client

Downloads

Download demo project - 40 Kb
Download source - 6 Kb