[英]Connect to boost named pipe
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. 现在,我在cmd中执行
echo 42 > \\\\.\\pipe\\SamplePipe
,并希望对缓冲区进行异步读取。 But instead I get the following error: "All pipe instances are busy." 但是相反,我收到以下错误:“所有管道实例都在忙。” Can somebody please explain to me why this is happening and how i can fix it?
有人可以向我解释为什么会发生这种情况以及如何解决吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.