Hi all,
should it be possible to send messages between processes with a NamedPipe?
As far as I understand the documentation it should, but I can’t send anything to the JuceDemo with the following code:
void sendText()
{
NamedPipe pipe;
if (pipe.openExisting("juce demo pipe"))
{
const String text("Test_pipe");
MemoryBlock messageData (text.toUTF8(), text.getNumBytesAsUTF8());
pipe.write(messageData.getData(), messageData.getSize());
pipe.close();
}
}
This will also hang the JuceDemo after being called.
It works with a simple InterprocessConnection Object:
class IPCTest : public InterprocessConnection
{
public:
IPCTest()
{
if (connectToPipe("juce demo pipe", -1))
{
const String text("Test_IPC");
MemoryBlock messageData (text.toUTF8(), text.getNumBytesAsUTF8());
sendMessage(messageData);
disconnect();
}
}
void messageReceived(const MemoryBlock& message) {}
void connectionLost() {}
void connectionMade() {}
};
When I create an IPCTest object, the message gets sent to the JuceDemo.
In the end I’d like to send data from a command line application. I ran into an assertion when trying to create an IPCTest object in a non-GUI application; I suppose the InterprocessConnection needs a message thread.
Am I doing something wrong with the NamedPipe object or is there any other way to connect from a command line app to another process?
Thanks,
Chris