Hi,
I got a problem with interprocess communication.
I am working on a project using named pipes for Server/Client communication.
Server:
Creates named pipe.
Reads Events.
Client:
Connects to the named pipe.
Sends Events.
Test procedure:
step1: Run server.exe, it creates a named pipe.
step2: Run Client.exe, it connects to named pipe and sends the events.
Observation: server.exe receives the events sent by Client.exe.
step3: close the client.exe.
step4: Run Client.exe again.
Obseration: Error 231( All pipe instances are busy).
Note: server.exe is never closed.
The code in the Client.exe has been confirmed to close pipe and disconnect pipe as below code.
Thanks for your reply.
Yes, the server has to be forcefully open again in order to establish connection with the client.
Is there a way I could implement so that the server is just opened once to connect to client multiple times?
Yes, there is. I don't remember. Maybe Computergeek01 does, however.
I remember you listen with one thread, and you then accept with other threads. Or maybe the listening thread accepts and processes and a new listening thread is open? Either way you need multiple threads.
I vaugley remember reading something like that but I couldn't get it to work. I have a bad habit of destroying notes\projects that don't go anywhere when I get too frustrated. I like webJose's idea though, that sounds like the way I would go about doing it.