2

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?

sehe
  • 374,641
  • 47
  • 450
  • 633
parean
  • 305
  • 3
  • 13
  • this is sign that `ConnectNamedPipe` not called by your code. i dont know what is `bp::async_pipe` constructor doing but doubt that `ConnectNamedPipe` (or `NtFsControlFile` with `FSCTL_PIPE_LISTEN`) called inside constructor. – RbMm Mar 19 '19 at 19:42

1 Answers1

2

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

parean
  • 305
  • 3
  • 13
  • It still doesn't work for unrelated processes. Named pipes are normally used for unrelated processes (you can use anonymous pipes for parent/child relationships). I had to resort to tcp sockets to get the functionality I enjoyed on Linux on the Windows OS using asio. – DAmann Aug 30 '21 at 12:38
  • Is your issue with unrelated processes related to windows 10 v1709 limitations listed here - https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-getnamedpipeclientsessionid#remarks – moi Sep 08 '21 at 17:23