LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview matlab tcp ip error when closing connection

Hi!

 

I have been working with tcp/ip where Matlab is the server and Labview is the client and now I am facing  a problem related when closing the connection of Matlab before Labview.

 

The idea is that if a problem occurs while capturing data from the Matlab, lets say instruments of other functions,and the program is interrupted and  the conexion is closed (from Matlab side), Labview does not handle it well into a point that continuosly poops up an error dialog  and does not let me do anything more with Labview, until I literally shut it down with the window task manager.

 

Can someone explain me why? and how can I fix this please ?

 

Thank you

0 Kudos
Message 1 of 4
(3,129 Views)

What is the error code and source?

 

I recall from the last design that you shared when initially getting it working, a TCP read function was in a loop with its error handled by passing to a tunnel, with the loop polling a front panel control for a stop condition.  In that case, I would not expect an error dialog to pop up like that.

 

However, if you are working with something different now, then perhaps you have something like:

  • A TCP Read function in a while loop
  • The while loop stop condition set to not be programmatically handled (such as by polling a front panel control like before)
  • No delay in the loop
  • Automatic error handling enabled on the VI
  • No error handling on the error out terminal from the TCP Read function

In such a situation, I would expect the behaviour that you described.  You should handle the TCP Read error, such as stopping the loop on error and then having some handling outside of the loop to decide if you need to close or try again, etc.



0 Kudos
Message 2 of 4
(3,119 Views)

It's interesting you say LabVIEW isn't handling it well.  LabVIEW is just doing what you're telling it to.

 

You didn't post your code, but it's pretty apparent you didn't put it together well.  You're using automatic error handling instead of manual.  That's going to flag an error whenever it sees it.  That's expected.

 

Start taking care of your errors.  Use your error wires.  Use shift registers.  Use basic error handling.  That will solve the issue you're seeing.  The error is expected.  The way you have it coded, it's expected to flag continuously.  Why be surprised when it acts as intended?

0 Kudos
Message 3 of 4
(3,113 Views)

Good afternoon,

 

Yes thanks to you VItan, I managed to move in a good pace with both of my codes from last time, since then I have been using the template that you suggested. I have expanded partially the code from Labview.

 

The error that I have been encountering is "Error 66 occurred at TCP Read in exchangeData.vi". So the error occurs in the following way, if I close the loop from Matlab with ctrl+c there is no problem, actually nothing happens to the Labview Program but if in the code that I create from Matlab I introduce an intentional fclose (for example try (function) catch me (fclose...) but I have tried other variants as well) in the middle of the code, it does appear the Error 66.

 

What I am trying to do is that if for some reason all of a sudden the program from Matlab has to close, caused by an external error while capturing data and has to jump to fclose, well everything shuts down as if I was applying a manual ctrl+c.

 

The matlab code works between Matlabs, in oder words if I apply the same code between Matlab, no errors like this occurs; that is why I am very confused and do not know how to fix it

 

Thank you very very much once more

 

 

 

0 Kudos
Message 4 of 4
(3,078 Views)