LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid input parameter for TCP vi

I'm programming a TCP-connection between the RT-module and the Windows-computer. At certain point I want to clear any errors before actually closing the connection. However when I run the application, Error 1 ("Input parameter is invalid") is returned. When I don't clear the errors, there is no problem. When I connect a error-constant, I get the same problem.
0 Kudos
Message 1 of 7
(5,680 Views)


@Peter Tjeerdsma wrote:
I'm programming a TCP-connection between the RT-module and the Windows-computer. At certain point I want to clear any errors before actually closing the connection. However when I run the application, Error 1 ("Input parameter is invalid") is returned. When I don't clear the errors, there is no problem. When I connect a error-constant, I get the same problem.




Typically error 1 would mean that you passed an invalid refnum to the function. You can do that easily in LabVIEW by opening a connection writing the refnum into a global and at some point end the VI hierarchy which did the open. Then start another VI hierarchy such as Reading from that refnum or simply closing the refnum and you get that error. LabVIEW does so called garbage collection. It remembers for each refnum who did open/create them and once the hierarchy of VIs who did goes idle it automagically closes those resources and disposes the refnum. The value stored in a global to be used by other function is now containing a refnum which is not existent anymore and you get error 1.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 7
(5,675 Views)
so, what's the work around for this if you need to pass the ref. num. into a global and back into another .vi?
0 Kudos
Message 3 of 7
(5,476 Views)

There is more than one solution....

 

Keeping the VI alive (don't let it go idle) is the simplest solution. Otherwise if you VI's have to go idel then you will have to start at the begining and open the connection again.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 4 of 7
(5,474 Views)
how do i keep it from going idle? (i'm sequencing them in teststand.)
0 Kudos
Message 5 of 7
(5,469 Views)

I'll assume you are loosing the connection on the Windows side.

 

You could have a test step that runs up-front that runs a VI in the bbackground that initializes the port and keeps the ref in an Action Engine but otherwise this VI the VI keeps running with calling the AE.

 

All other steps would access the Ae to get the connection info.

 

When the test seq is done kill the VI running in the background.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 7
(5,458 Views)

Ben,

    your suggestion works perfect, i run a vi in a new thread with the telnet connection being held there, talk via another vi in the main seq. and terminate when completed. thanks

Kris

0 Kudos
Message 7 of 7
(5,303 Views)