I'm trying to create a two-way communication channel between two programs (one in Python and another in C#)
When I create a named pipe between two C# programs or two Python programs, everything is OK, but when I try to (for example) connect to the C# server from Python code, it does not work:
C# code:
NamedPipeServerStream server = new NamedPipeServerStream("Demo", PipeDirection.InOut,100,PipeTransmissionMode.Byte,PipeOptions.None,4096,4096)
If I use win32pipe in Python, code blocks on ConnectNamedPipe (it never returns)
p = win32pipe.CreateNamedPipe( r'\.\pipe\Demo', win32pipe.PIPE_ACCESS_DUPLEX, win32pipe.PIPE_TYPE_BYTE | win32pipe.PIPE_WAIT, 1, 65536, 65536, 300, None) win32pipe.ConnectNamedPipe(p)
If I use open function, it just establishes a connection, but nothing occurs:
open( '\\.\pipe\Demo', 'r+b' )
Now if I close the Python program, C# server receives just one data item from Python and a System.IO.IOException raises with "Pipe is broken" message
Am I doing anything wrong ?