Does anyone know where I can find a good example of duplex pipe communication between a process running Python and another running .NET (C#)? I am trying to do this with win32pipe. The documentation on this leaves much to be desired.
I found this example:
However, it only does a one-way operation, sending data from the server to the client.
Can anyone show me how to modify (augment) the code so that an object is sent from the client to the server, which does something to modify the object, then send it back to the client? Do I need to create another pipe to send data from the client to the server?
Does anyone know where I can find a good example of duplex pipe
communication between a process running Python and another running .NET
(C#)? I am trying to do this with win32pipe. The documentation on this
leaves much to be desired.
However, it only does a one-way operation, sending data from the server to the client.
Can anyone show me how to modify (augment) the code so that an object
is sent from the client to the server, which does something to modify
the object, then send it back to the client? Do I need to create
another pipe to send data from the client to the server?
Disclaimer: I am not a Windows person.
Looking at the code, the pipe seems to be set up to send in only one
direction (write in the client, read in the server). So in that case you
will need a second pipe set up the other way around: have the server
write the result to the client via the second pipe when done.
It may be that you can set these up in a bidirectional way - that would
be more normal. That depends on exactly what semantics a Windows pipe
provides: it needs to be like a network “connection” in that it actually
provides 2 data streams: one to send and one to receive. The you can
send your request and receive a result. On the server side you receive
the request and send the result.
In UNIX, pipes are not like that - you need 2 to do this kind of
comunication, and there is a distinct thing called a socket which
provides 2 channels (for send and receive). So you need to check what
kind of thing a Windows pipe is.
It does not require two pipes. The article example actually sets up a two-way pipe, that’s what PIPE_ACCESS_DUPLEX specifies. The same handle works for both reading and writing, using ReadFile and WriteFile.