Python Forum
Duplex pipes - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Duplex pipes (/thread-31516.html)



Duplex pipes - GrahamL - Dec-16-2020

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