How to stop an exec Node, run another exec Node and when it's finished rerun the first

Hello
i'm new to Node Red , i'm working with a Lora Gps Hat.
i have raspberry C code to send Data and another to receive data . the Lora hat can't be receiving and emitting at the same time
i have tested the exec Node to send data it's working perfectly
and i used a daemon Node to receive data also it's working

what i like to do is when i need to send data from the pi to the Arduino
i want to stop the receiving daemon node ,run the send exec node , then rerun the receiving daemon node

The daemon node can auto restart after being stopped. So you could kill it. Do the transmit an let it restart

Thanks for the answer ,
but it will launch straight after sending this to it to its input .

delete msg.payload;
msg.kill="SIGKILL";
return msg;.

. there isn't a delay to launch it when it has an error ..

You'll have to forgive my ignorance I have no idea what a lora hat is. But ... I don't understand what you mean when you say can't be receiving and sending at same time & therefore you have 2 C applications?

Can't your application just close and open ports without quitting?

What protocol is this? Isn't there a node-red node than can communicate with this device? Or perhaps a nodejs module you could build a node-red node from?

Are there no other options like adding MQTT into the mix for inter-device communication?

Dear Steve ,
Thanks for reaching out , Lora is a type of modulation (Physical layer in the Osi Model) to send and receive data over large distance with minimum power .. the Lora hat is a board with an antenna that gets plugged to the raspbery Pi that supports Lora .
i'm using this code https://github.com/dragino/rpi-lora-tranceiver/tree/master/dragino_lora_app
for the raspberry pi..
i have 1 code that can be either receiving or either sending .. from argv1 if i send data to it i will be sending if not i will be receiving.

as for the mqtt part , it will be also for sending and receiving from mobile to the hat that will be also sending and receiving for the arduinos

i didn't manage a way to edit the C code (it's the official code for the board)

So that code it seems is written to read command line and based on the command line arg, operate exclusively as a sender or receiver.

I see no reason why you can't switch between these modes without quitting (obviously some modifications to code & testing would be required).

Additionally, at a quick glance, all communication to the board appears to be SPI. I believe there are node-red nodes for communicating over SPI. so (speaking from zero experience) it seams using the code you linked to, you could figure out the various commands and constants required to do this without any C code. All in node-red/nodejs

Just a thought.

Sorry I can't be of more help.

thanks for your help i'll see what i will do

By default the daemon node has a 10 second pause before restarting. So if you kill it it should give you time to fire your transmit.

it doesn't get killed
i sent a function with the parameters below
msg.kill = "SIGHUP";
return msg;
it keeps running even though it shows an error

I am facing the same issue, Help me Out to return the msg.kill...

There have been some changes to the way exec works since this thread, please start a new thread with more details of what you are doing and what the problem is.