As you have seen, you can use for inter process communication :
- Shared memory
- Named pipes
- TCP/UDP sockets (eventually local ones)
Shared memory has the advantage of performance, because you do not have any buffer when sending/receiving messages. But you have to synchronise your data exchanges whith another IPC. It can be IPC semaphores or ... named pipes or sockets.
When performance is not the main goal, I tend to prefer sockets as their use is simple and can be extended to inter computer communication.
The best way is to abstract your communication with a class that can use shared memory when the two processes are on the same computer and sockets if not. Then You have to choose between UDP and TCP ;-)
For synchro / buffer exchange, prefer TCP as it more reliable.
I do not use named pipes as I prefer socket for the possibility to use inter computer communicationand of course you can find a lot of portable socket libraries...
my2cents
EDIT:
For synchronisation, shared mem is perhaps not the best tool. In your case it can be used by sharing a small memory space, with a space for each process that wait for commands. You can either poll for any incomming command or use a shared semaphore. The fastest way is your processes waiting for named semaphores and reading a shared mem space for their commands/parameters. Using named pipes is surely simplier but not that fast. You surely do not need to be that fast ? Anyway abstract that in a class that models your exchange protocol and try the two ways :-)