[C++] Named Pipes.

named pipes

Pipes are a form of interprocess communication, they are read and written to much like files. Named pipes, to quote MSDN:

“Named pipes provide interprocess communication between a pipe server and one or more pipe clients. They offer more functionality than anonymous pipes, which provide interprocess communication on a local computer. Named pipes support full duplex communication over a network and multiple server instances, message-based communication, and client impersonation, which enables connecting processes to use their own set of permissions on remote servers.”

Named pipes consist of two parts:
* The server (Receives the text)
* The Client (Sends the text)

The API’s you are going to be working with are:

* The server:
CreateNamedPipe
ConnectNamedPipe
ReadFile

* The client:
CreateFile
WriteFile

You can view the source code for both parts at the following links:
[ C Code ]Server.
[ C Code ]Client.

For an example of a real-world application of named pipes have a look at the communications code for the Wifi eSpy project of mine on this blog.

[ Blog Post ] Wifi eSpy

Advertisements

~ by Rhys Mossom on June 3, 2007.

9 Responses to “[C++] Named Pipes.”

  1. You are the best!!!!

  2. Great Trick

  3. Aye

  4. the link for the code is not working …plz help

  5. If youre using VS did you include stdafx.h?

  6. Thanx for great help man, few info and everything is clear.

  7. OMG, tysm, this is the only full example I could find!

  8. http://theundead.atspace.com/Blog/namedpipeserver.txt
    http://theundead.atspace.com/Blog/namedpipeclient.txt

    links are not live

  9. links work for me…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: