Named Pipe Wrapper for Win32 Platforms | CodeGuru

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Aug 2, 2001
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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.

Advertisement

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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.