Discover InterprocessConnection to connect to


#1

Hi,

 

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!

 


#2

I'm doing something similar, but with the opposite skill set - I'm pretty lost in Windows :D

Maybe we could help each other - contact me off-forum...

 

OS X is built on a version of UNIX that supports 'message passing'.

To receive messages:

    [[NSNotificationCenter defaultCenter] addObserver: ...

To send messages:

    [[NSNotificationCenter defaultCenter] postNotificationName: ...

 

It's more difficult in c or c++, but still functions in the same basic manner.


#3

Hi auricula,

on windows systems there is a special kind of shared memory that is deleted once the last process that was using it is terminated. It a bit like a smart pointer. The boost library got a very good implementation for that: boost::interprocess::windows_shared_memory


#4

Is it possible to use the MessageManager to send a broadcastMessage to all my other plugins, or will I run into problems on some hosts?


#5

I only need my plug-in to 'talk' to other instances of itself. For example, the same plugin inserted on tracks 1, 2, & 3 - #3 might want to know what #1 is up to, and so on... 

This works for both signed and unsigned code ( at the moment ). Works in both Mavericks and Yosemite. Works in VST, VST3 and AU's.

Tested, and working, in:

  - REAPER

  - Cubase 7.5

  - Logic

  - Ableton 9

  - Audition

 

So, I'm trying not to jinx this, but it's looking pretty good :D


#6

I've looked a bit closer into the source code of the juce::MessageManager. The implementation uses the NSNotificationCenter on the OS X side, and is using the WindowMessage api on Windows. So if you want to port your implementation to windows the juce::MessageManager looks like the right choice.