[Boost-users] Using async_pipe as named pipe in windows

376 views
Skip to first unread message

parean via Boost-users

unread,
Mar 20, 2019, 9:22:09 AM3/20/19
to boost...@lists.boost.org, parean
I have this code:

boost::asio::io_service ios;
std::vector<char> buf(20);
bp::async_pipe ap(ios, "\\\\.\\pipe\\SamplePipe");
boost::asio::async_read(ap, boost::asio::buffer(buf),
[](const boost::system::error_code &ec, std::size_t size) {});
ios.run();

Now, I execute "echo 42 > \\.\pipe\SamplePipe" in the cmd and expect an
asynchronous read to the buffer to occur. But instead I get the following
error: "All pipe instances are busy." I'm sure I'm doing something wrong.
Can you please tell me what should I add to my code for it to work?



--
Sent from: http://boost.2283326.n4.nabble.com/Boost-Users-f2553780.html
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Stian Zeljko Vrba via Boost-users

unread,
Mar 20, 2019, 10:09:15 AM3/20/19
to boost...@lists.boost.org, Stian Zeljko Vrba
You need to read and understand topics linked from this overview page: https://docs.microsoft.com/en-us/windows/desktop/ipc/named-pipes
I'm unsure whether all the necessary steps are achievable using only asio (e.g., CreateNamedPipe and ConnectNamedPipe).
Reply all
Reply to author
Forward
0 new messages