InterprocessCommunication not working


#1

I’m trying to user InterprocessCommunication to 1) Check if another instance of the application is up and 2) If it is, send the command line to the active instance. So I first try to createPipe because docs say:
http://www.rawmaterialsoftware.com/juce/api/classInterprocessConnection.html#a7ddea65e7dbb25d1d471db7355743276
"If another process is already using this pipe, this will fail and return false."

This is not true. Both instances of the appl have NO problems whatsoever to create the same named pipe. Argh!!


#2

Are you aware of JUCEApplication::anotherInstanceStarted()? maybe it can be of help to you.


#3

anotherProcessStarted() would certainly be a better way to do what you describe, but I’m a bit worried that the interprocess stuff isn’t working. What OS is this?


#4

Dammit, I’m trying to find a thread where we (I & Jules) discussed that the whole mechanism of anotherInstanceStarted is non-functional on Mac OS X, but I can’t find it (even by searching threads in which I’ve posted)!! Also, the conclusion was that Jules recommended me to “roll my own”, ring any bells ?


#5

10.6.7


#6

Found it!! http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=6436


#7

Oh, and to use an InterprocessLock doesn’t work, well… it does work, but for admin users only. If you try to run the application as a “Standard” user, InterprocessLock will always be “locked” (indicating another instance is active).


#8

So you mean that it was failing because you were making the call during a modal loop in the initialisation method?

(I actually think that in more recent versions I changed things so that the app’s initialise method gets called later, to avoid this kind of problem)


#9

Sorry, I don’t quite follow ? I have no modal loops. The InterprocessLock::enter(0) always returns false when running under a “Standard” user, which means you can’t execute the application at all (as that is the condition for another active instance). But when running with a “Admin” user, it works as expected.


#10

I was talking about the thread that you linked to, where it was talking about not receiving events during the JUCEApplication::initialise() method (?)

I think I also fixed the admin permissions problem very recently, just because it needed to use a different folder for its temp files.


#11

Ah, I see. Well I do use 1.53 (oops I didn’t mention that,did I ? :wink: so that will be fixed then. Regarding receiving events, I won’t have that particular problem.


#12

Well… the HTTP stuff uses events internally, so it could indeed be causing your network problem.


#13

Well… the HTTP stuff uses events internally, so it could indeed be causing your network problem.[/quote]
But I’m well out of initialise when we talk http stuff (which is unrelated to this thread)… :?


#14

Gah… sorry, so many threads!


#15

:smiley:


#16

Hi Jules, do you know in which commit these issues were fixed ?


#17

Hi Jules, do you know in which commit these issues were fixed ?[/quote]

Not off the top of my head, but think it was within the last month.


#18

Hmm… last commit for juce_posix_SharedCode.h (where IPL is implemented) was 3rd of july 2011, am I looking in the wrong place ? :?


#19

You’re probably looking at that file before it got moved to a new location in the modules shake-up.


#20

Ouch, ok, then a quick pointer to where I should look now would be appreciated :slight_smile: