I've got two different plugins. An instance of plugin A should connect to a an instance of plugin B to send some configuration data. I'd like to implement the connection using a InterprocessConnection via named pipe. My idea is that each instance of B will create a named pipe and wait for an instance of plugin B to connect to it. so far so good.
I'd like to create a list of all availible pipes in A so the user can select an instace of B to connect to. Is there a smart way to discover all named pipes (maybe with a prefix like "PluginName_*")?
Right now my idea is to use one pipe with a name that is known by all plugins. All instances of plugin B are constantly trying to connect to this pipe to report the name of their pipe. If an instace of B wants to discover all named piped it creates this pipe and will receive all names.
Another approach would be to create a list of all names in a shared memory block. All instaces of B would register their names in this list and A could just fetch them from there. On Windows this would be a proper solution as shared memory is not destroyed until it's released by the last process. I don't know if that's also the case on OS X. You've got to keep in mind that the plugin that created the shared memory block (instace of B) might get destroyed at one point while the other plugins are still alive.
I'd really appreciate your suggestions!