简体   繁体   中英

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. 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?

In the new version of the boost it's fixed. See this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM