broadcasting with named pipes

I am exploring to use named pipes for IPC for the low latency and reliable need. At this moment I'll have the pipe server to listens to the following simultaneously:

1. Keyboard input for the next action (read data from file, read data from keyboard input, etc...)
2. Wait for client connection
3. Wait for messages from connected clients (and respond in the same way as #1)

When #1 is triggered, it will broadcast a sequence of struct's to all connected clients.

I'd prefer single threaded server as broadcasting to all clients across different threads would be harder if I choose different threads for each client.

Particularly, I'm referring to the examples here
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365799%28v=vs.85%29.aspx


So initially I'm thinking I'll need to do the following on the server
1. create a named pipe for each connecting client and save connected pipes in a vector / array
2. using overlap I/O or completion mode????
3. create a separate thread to read from keyboard input, which will then call "HandleInstruction(instruction)" function
4. Once clients connected, setup a async ReadFile (may be ReadFileEx?) which upon receiving messages from clients, will call HandleInstruction as in #3.
5. Once it decided to read data from file or from keyboard or from client, it will create a corresponding struct and call WriteFile to every pipe that the clients has connected.

All of these, especially #5, seems very cumbersome. Is there any more realistic and simpler way to broadcast struct across all connected clients using pipes?
Topic archived. No new replies allowed.