LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to restart an application?

A Host.exe interacts with a few cRIO targets over UDP sockets. I need to change the IP address on the host.exe to switch between the targets. After I make the IPs change (select a file with the IPs and ports for example) I would like to add a button on the host.exe GUI panel to restart the host application with the purpose to set the UDP socket with the new IPs.

Thank you

Marcelo 

0 Kudos
Message 1 of 6
(3,739 Views)

Hi Marcelo,

 

and what's your problem? Don't you know how to add a button?

 

In general I wouldn't "restart" the exe, I would create a state machine with (atleast) the steps of "load ini file", "init UDP ports", "processing" and "close UDP ports". Then all you need to do is going back to state "load ini file"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,705 Views)

I have tried changing the IP sockets using a similar process like the one you suggest, but it works only with the first iteration. When I restart the application (from the menu), the sockets reinitialize in a manner that works every time.

How would the code look like if it was done with a button, I get the impression that you know how to restart the application.

Thank you again

Marcelo 

0 Kudos
Message 3 of 6
(3,693 Views)

Hi Marcelo,

 

How do you restart "from the menu"?

Why does "it" only works the first time?

 

With a button you can only choose the case of a case structure - or a state of a state machine...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,669 Views)

Send a command to the cRIO to make sure it closes the UDP connection and then looks for a new connection.  This is what I do with TCP/IP.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 6
(3,646 Views)

on the RT side of things, there shouldn't be a need for closing the "connection" (aka socket), since UDP is stateless, the UDP connections can stay alive, and therefor the RTs will always be listening.

 

on the host.exe you should "open -> do something -> close" the UDP connection,

but you can have multiple connections (aka sockets open), one for each RT target,

there shouldn't be any real need to restart your whole host.exe app


If Tetris has taught me anything, it's errors pile up and accomplishments disappear.
0 Kudos
Message 6 of 6
(3,624 Views)