Get the data from running linux app in real time

Hello all

I am going to get the data on node-red from running app.
The source code I am running is as following.

status = bscXfer(&xfer);
if(xfer.rxCnt > 0 && status > 0) {
cout << "Received " << xfer.rxCnt << " bytes:\n";

            for(int i = 0; i < xfer.rxCnt; i++)
                cout << xfer.rxBuf[i];

            cout << "\n";
            xfer.rxCnt = 0;

This app is working well, but I am going to receive xfer.rxBuf[i] data on node-read in real time while app is running.

I have studied exec node and daemon node for it, but I have not found the solution for it.
Hopefully I want to implement using stdout.
What's the best method for it?

Thank you

Have you thought about rather than read/write to/from stdout with the app/node-red, to utilise MQTT and send data from your app to Node-RED over MQTT? You would then run each as separate processes, and can start/stop both without having to keep the other process in mind, nor forking.

If you're not familiar with MQTT, here's a good getting started manual to understand the concept behind it.
On top of that, there are good C++ libraries available for MQTT.

Thank afelix.

This thread is running once per 20 ~ 50ms.
I am wondering that MQTT can support thus timing.
What is your thought for it?


Hi, MQTT can support that but it might be a problem for your hardware, which platform are you using?

I am using Raspberry PI Zero W.

Hello afelix and ghayne

Thank you for your comments.
I think MQTT is good for me, but I am not familiar to it.
What MQTT library for C do you recommendon my application?

Thank you again.

Depending on where you run your application, either use one of the standard Paho MQTT libraries (regular / embedded), or when running on Arduino or ESP8266/ESP32 that deploy through the Arduino IDE, use Nick's PubSubClient.

I am really not sure if a Pi Zero will be able to manage this on "every 20 ~ 50ms", while also running other applications on it. That equals between 20 and 50 times a second. The Pi zero series is remarkably slower than other raspberry models, as is to be expected.

1 Like

Thank you afelix

I am considering to IPC(Inter Process Communication) for communication between app and node-red.
I have found node-red-contrib-ipc node for it.
But I have some troubles to create & open the fifo.
Also I am not sure if I can use node-red-contrib-ipc node on my application.

Please let you check my new solution and give me your suggestion.

Thank you.

I have used MQTT as ghayne said before, then I resolved it.
Thank you ghayne and afelix.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.