Help with Windows Named Pipes

Ken Gibson 0 Reputation points
2024-11-13T15:36:38.7066667+00:00

Win32 experts,

I'm writing an app that includes a master process written in C# that forks a subprocess written in Python and compiled into an exe. I am attempting to open named pipe between the two and despite working through all online tips and all of copilot's suggestions for getting this to work, am still getting 'The system cannot find the file specified.' error in the child process.

I have:

  1. Used the correct pipe naming format. In this case: "\.\pipe\derPipe"
  2. Confirmed the child process receives and uses the correct pipe name;
  3. In the parent, confirmed the pipe is successfully created;
  4. In the parent, insure the child is authorized to open the pipe using copilot's suggested code: PipeSecurity pipeSecurity = new PipeSecurity(); pipeSecurity.AddAccessRule(new PipeAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), PipeAccessRights.FullControl, AccessControlType.Allow));
  5. I then pass this PipeSecurity object in the call to create the NamedPipeServerStream;
  6. In the Python child, wait for the pipe to be ready with: win32pipe.WaitNamedPipe(pipeName, 2000) - after confirming pipeName contains the correct name. This function is where I actually get the 'system cannot find the file specified' error.

At this point I've run out of ideas, online suggestions, & copilot suggestions for getting this to work. Any additional tips are greatly appreciated.

Thanks!

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,539 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,666 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.