Giter Site home page Giter Site logo

igoryunusov / win32-named-pipes-example Goto Github PK

View Code? Open in Web Editor NEW

This project forked from peter-bloomfield/win32-named-pipes-example

0.0 1.0 0.0 152 KB

Simple example code for working with named pipes using the Win32 API.

License: MIT License

C++ 100.00%

win32-named-pipes-example's Introduction

win32-named-pipes-example

Simple example code for working with named pipes in C++ using the Win32 API.

For a full explanation see the accompanying blog post here:

Author

Peter R. Bloomfield.

License

The code is made freely available under the MIT open source license (see accompanying LICENSE file for details). It is intended only for educational purposes. and is provide as-is with no guarantee about its reliability, correctness, or suitability for any purpose.

Server and client

There is example code for two programs, named "server" and "client".

The server program will open a named pipe, wait for something else to connect to it, and then send some data over it. The client program will look for a named pipe, connect to it, and then wait to receive some data through it.

The code for each of these programs can be found in src/server.cpp and src/client.cpp respectively.

Building the programs

Visual Studio 2015

Solution/project files are included for VC12 (Visual Studio 2015). The Community edition is excellent and is free for individuals and small teams. You can download it from here:

In the vc12 folder in the repository, you will find a solution file called win32-named-pipe-example.sln. Open it in Visual Studio. Open the "Build" menu and click "Build Solution". Both programs should be compiled and linked.

The resulting executables will be put in vc12/Debug or vc12/Release, depending on which configuration you built.

Running the example programs

After building both programs, first run the server program. It will open a console window and you should see it report that it has opened a pipe and is waiting for a connection. Leave the server window open and run the client program. It will open a console window as well. It should indicate that it has connected to the pipe and received some data. Go back to the server window and you should see it report that it has sent data.

Note: If you are working with Visual Studio, I recommend running the programs outside the IDE; i.e. in Explorer, navigate to vc12/Debug or vc12/Release and double-click the executables. This is because it's tricky to run two different programs from within a single Visual Studio solution (I'm sure there's a way to do it -- I just haven't found it!).

win32-named-pipes-example's People

Contributors

peter-bloomfield avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.