05-02-2017 12:49 PM
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
05-02-2017 01:32 PM
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"…
05-02-2017 02:03 PM
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
05-02-2017 03:43 PM
05-02-2017 08:05 PM
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.
05-03-2017 06:37 AM
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