Python Forum

Full Version: Duplex pipes
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I have created to projects for a client and server user named pipes by following the code here
Server
and
Client

Everything works correctly
But I need full duplex so either side can read and write
I tried creating a read thread in the server
t = threading.Thread(target=read, args=(pipe,))
t.start()

def read(p):
    while True:
        # Read the data from the named Pipe
        resp = win32file.ReadFile(p, 65536)
        print(f"Data Received: {resp}")  # if function fails, the return value will be zero
The client connects but the server app crashes when writing to the pipe

How can I achieve this
Thanks