InterprocessConnection loose messages


I'am writing a dameon using pipe for interprocess communication.

When i receive a message from a client, i do some logging.
When i send 2 or more messages to the daemon, the interprocessConnection class seems to only receive the first one : the others messages are lost.
If I do some sleeping beetwen my message sending, all of them are correctly received.
I tried to change InterprocesConnection callback ( message or server thread ) but i still have the same issue.

Any idea ?



I'am still wondering why messages are lost.

By the way, while looking at JUCE source code for InterprocessConnection, i think i’ve spotted a little mistake.

in InterprocessConnection::readNextMessageInt()

 while (bytesRead < bytesInMessage)
                if (threadShouldExit())
                    return false;

                const int numThisTime = jmin (bytesInMessage, 65536);
                const int bytesIn = (socket != 0) ? socket->read (((char*) messageData.getData()) + bytesRead, numThisTime, true)
                                                  : pipe->read (((char*) messageData.getData()) + bytesRead, numThisTime,

                if (bytesIn <= 0)

                bytesRead += bytesIn;

I think that NumThisTime sould be : jmin (bytesInMessage - bytesRead, 65536);


Yes, good catch! Many thanks for that!

And nothing to say about loose, Jules? You must be mellowing.

Hehe, that was my first thought when I saw the thread title :wink:

I came close to loosing my temper when I saw it, but managed to stay calm…