[Boost-users] [asio] Named pipes on Windows?

1,809 views
Skip to first unread message

Allen Cronce

unread,
Apr 23, 2009, 10:27:58 AM4/23/09
to boost...@lists.boost.org
Hi all,

I'm working on a cross platform server daemon. Clients communicate
with the daemon using boost asio.

For the posix implementation, it's convenient and appropriate in our
case to use Unix domain sockets. I've experimented with the related
asio "local" sample code and verified that it will work for our
purposes.

For Windows it looks like named pipes are sort of the equivalent of
Unix domain sockets. But while asio has a "stream_handle" interface
that accepts a Windows handle, all of the sample and test code passes
invalid handles. I haven't found any working sample or test code that
specifically integrates named pipes with asio.

All I've found so far is an email to this list on March 13th from
Andrew Solodovnikov who was having problems getting named pipes to
work with asio.

Has anyone successfully used asio and Windows named pipes? If so,
would you be willing to share some sample code that demonstrates the
functionality?

Thanks in advance.

Best,
--
Allen Cronce
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Boris Schaeling

unread,
Apr 23, 2009, 12:13:02 PM4/23/09
to boost...@lists.boost.org
On Thu, 23 Apr 2009 16:27:58 +0200, Allen Cronce <allen...@gmail.com>
wrote:

> [...]Has anyone successfully used asio and Windows named pipes? If so,

> would you be willing to share some sample code that demonstrates the
> functionality?

I've used asynchronous operations with named pipes in Boost.Process. The
named pipe is hidden within Boost.Process and not exposed by the library
(this is something which will probably change). The code however works.

I wrote an article about Boost.Process only a few days ago. There is a
sample with Boost.Asio at
http://www.highscore.de/cpp/process/index.html#communicating. Here's the
code which I use to create a named pipe:
https://svn.boost.org/svn/boost/sandbox/process/boost/process/detail/pipe.hpp
(search for BOOST_PROCESS_WINDOWS_USE_NAMED_PIPE).

HTH,
Boris

Reply all
Reply to author
Forward
0 new messages