Has anybody been successful in using Named Pipes in Unity. We have two Unity programs, one is a launcher and the other(s) will be launched from it. Think of something like steam. I already have a launcher launching the other experience and now I need to transfer data. I get a not implemented error when I try to do a new NamedPipeServerStream, so I'm guessing Unity doesn't have an implementation for it, but just wondering if anybody found a solution for this. Thanks!
A quick google of this found the below thread which seems to blame Mono for an incomplete implementation in this area. https://forum.unity.com/threads/using-system-io-pipes-for-ipc.592003/
Interesting find. I'm basically running into what this guy is facing https://forum.unity.com/threads/namedpipes-not-implemented-in-unity-2019-1-4f1.692029/ Unfortunately, he doesn't appear to have a solution and no responses. Basically this call await pipeServer.WaitForConnectionAsync(token); throws an error with "The method or operation is not implemented.". The post you linked does mention the synchronous version working.
Hi there! I've been working with Named Pipes recently and I ran across tons of issues myself and found this post by googling. After tons and tons of experimentation I finally got it working. I'm posting my solution here just in case people in the future run across this thread just like I did. First I was working with 2019.4.12 and in the Editor everything worked fine, I could create Server Pipes and Client Pipes and communicate between them. Then the issue came when I made a Windows Build, all of a sudden the log was saying "NamedPipeServerStream is not implemented!" However the client has no issues, it seems that NamedPipeClientStream is implemented. And again no issues in the Editor, I don't understand how the Editor apparently has NamedPipeServerStream implemented while the build does not. I tried everything, updating to 2019.4.20, tried Mono, tried IL2CPP, tried .NET 2 and .NET 4, everything still said "not implemented" The solution was swapping out to 32 bit (x86 instead of x86_64) And with that now everything works. So here's my exact working Server setup: - Unity 2019.4.20f1 - Windows - 32bit (x86) - Mono - .NET 4.x And again the client had no issues so I'm running it on my standard parameters and everything works. Client Setup: - Unity 2019.4.12f1 - Windows - 64bit (x86_64) - Mono - .NET Standard 2.0 I create 2 pipes on the Server (one for reading and one for write) and 2 more on the Client. Each pipe on a separate thread, 2 threads on the server and 2 threads on the client Code (CSharp): new NamedPipeServerStream("LiveChat_SR_CW", PipeDirection.In); // ServerRead_ClientWrite ... new NamedPipeServerStream("LiveChat_SW_CR", PipeDirection.Out); // ServerWrite_ClientRead ... new NamedPipeClientStream(".", "LiveChat_SW_CR", PipeDirection.In); // ServerWrite_ClientRead ... new NamedPipeClientStream(".", "LiveChat_SR_CW", PipeDirection.Out); // ServerRead_ClientWrite Also I am not using async, not sure if that has anything to do with it. Code (CSharp): pipeReadServer.WaitForConnection(); ... string message = streamReadString.ReadString(); I was going insane trying to solve this and finally got it working, hopefully this post can help someone in the future! Cheers! EDIT: I made this video documenting my process so I remember it in the future and hopefully it might help someone else who stumbles upon this post: