LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP communication problem after some time

Solved!
Go to solution

Hi everyone,

 

I am talking with a Keyence laser distance measurement equipment :

- DL-EN1 : TCP/IP module communication

- IL-1000 connected on one side the sensing element IL-065 and on the other side to the DL-EN1 TCP-IP module equipment

 

I have attached the VI that works fine : I send "SR,00,044\r\n" and the read back is correct. My problem is that after some time (a few hours... something like after more than 600 000 loops) I get that error message (see attached print screen). I am completely new to TCP/IP with or without LabView. Would you have any recommandations ? :

- Ideally, what is wrong with my code?

- Is there a way to restart the communication propely?

- If my code is ok, what would be the best thing to do, in order to work around this problem? Missing a measurement is not of a problem. I just need the program to continue getting measurements after that communication problem.

 

I am running the program with Labview 2022 but I attached a 2015 version.

 

Many thanks for your help.

User

Download All
0 Kudos
Message 1 of 4
(1,841 Views)

Do you really need to spin the loop as fast as possible? What is a typical value of "x-y" (I can probably com up with a better label for that loop time indicator 😉 ). How often do you really need to read new data?

TCP is connection based and you create a connection before the loop and never again. You could easily add a state that creates a new connection when the error occurs. If you can live with the occasional dropped packet, maybe UDP is a better choice if the instrument supports that. (not familiar)

 

Connection errors can have many reasons and you simply need to deal with them in code.

0 Kudos
Message 2 of 4
(1,828 Views)

Hi Altenbach,

 

Lol about the loop time indicator... true.. my fault... I wanted to load a printscreen of the entire program and not just of that badely labelled indicator.

Thank you for your answer. This program is a simplified version of my orignal program that runs at much lower rate, I retrieve a mesurement from 3 sensors every seconds. And the problem accurs after 12 to 24 hrs. So I just wanted to spin in it up. But maybe I am generating another problem with

Yes, ok, I'll give it ago as you said, by managing the errors. So there is no abvious problem in my coding, appart from the loop time.

I guess I must use TCP Close Connection VI when I detect an error. And then relaunch the TCP open connection?

User

 

0 Kudos
Message 3 of 4
(1,820 Views)
Solution
Accepted by topic author user_79

Yes, simply keep the connection and error in shift registers and add a case structure that establishes a new connection whenever the connection is invalid or certain errors exists. If you want to read the sensors once per second, also add a suitable wait to the loop. Currently, your loop time solely depends on the communication and is thus jittery.

How does a typical response string look like? is it guaranteed to be less than 300 bytes?

0 Kudos
Message 4 of 4
(1,814 Views)