07-30-2010 12:38 PM
@meanmon13 wrote:
@ "Error 1 occurred at TCP Close Connection in TCPServer2.vi: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @." at a frequency so great that I cannot stop the VI and have to go into the task manager to end it. The second VI to start only errors out and does not even count seconds....
You should check if the refnum is valid before trying to close the connection. Otherwise, if you stop your server, that will close the connection. Now when you stop your client, it will try to close the connection there also. However, the refnum is invalid because the connection has already been closed by the server and it will display an error. Other than that, I'm going to let someone else step in since I can't draw anything up for you (no access to LabVIEW right now).
07-30-2010 12:40 PM
How do I check that it is valid?
07-30-2010 01:00 PM
The first change I would make is to replace the formatting with typecasting. The current code is not correct, for example the lenght can be more than four characters. (not here, but in general!).
Then the "open connection" needs to be inside the loop, because if it only tries once, and the partner VI is not yet running, it will never try again during the program run. You need some logic that whenever an error occurs, it should close the current connection and try to create a new connection at regular intervals.
07-30-2010 01:41 PM
Alright, I made your suggested changes but now 1 counts the seconds but the main loop doesn't run and on the other the main loop runs but it doesn't count seconds... and neither one seems to be receiving packets from any other. I am also still getting the same error as before but it seems to go away after a few seconds. I'm not sure if my "logic" works with the closing the current connection and creating a new one. What I want is for connections to only exist long enough for the packet to be sent and received and I'm not sure that is happening with having the close connection out side the loop but if I shouldn't have it inside the loop where should it be then? I want the packet to be received and then the connection is terminated. I'm planning on using this as a Data Acquisition Application with connections only existing to transfer one packet of data and with no expected a direct response.