02-03-2017 05:31 AM
Hello Dushy_11,
not elegant but working method, store the reference in a global variable and all SubVI´s use it. After the reconnect replace the reference in the global variable so all get the new one.
Better, do not transfer the reference, only the results so only in one VI write and read to TCP is done and from this VI the data will be transfered.
02-03-2017 07:06 AM
You have some basic logic problems.
Let's take a look at your first loop:
I convert that into pseudocode:
REPEAT
OPEN CONNECTION (192.168.11.2:5000, Timeout = 1000)
If Error, compose Fault Description.
STOP = not (not (Error)) or Exit Button
until STOP
so... as long as the connection succeeds, you keep trying, but as soon as it fails you quit ???
Why try to connect again if it succeeds?
Also check your following logic - it looks like you ignore things (green case) if you succeed, and do stuff if you fail.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
02-03-2017 10:24 PM
Hi Steve
I am so sorry that i forgot to remove one "not" function. Its only one "not" function in the running code.
Actually was trying something else so put one extra "not" function and afterwards forgot to remove it while posting the code here.
02-03-2017 10:38 PM
Hi
Thanks for your input. I will surely implement Global variable in my code as you suggested.
But i have few queries regarding the same.
1. When i am opening the Sub VI from my main VI, i am closing the Main VI through INVOKE NODE and again opening the Main VI when clicking back from the Sub VI. So in that case, if i communicate through TCP/IP in Main VI only, will i be able to send and recieve data in my Sub VI. I am sending & recieving different data based on my commands in Main VI & My Sub VIs
02-06-2017 01:42 AM - edited 02-06-2017 01:43 AM
Hello Dushy_11,
yes, the global variable should always be accessable, but be carefull that no racecondition happen, because you do not know exactly, when the variable was written or read. A queue like you use for the commands, could be helpfull to prevent you from a racecondition.
02-08-2017 02:24 AM
Hi Alexander
Thanks for your precious suggestion
I am not able to implement the same on my code as i am out of station officially.
Once i get back and implement the same, i will give you the feedback.
best regards
Dushyant