LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Read blocks remote Port

Solved!
Go to solution

HI,

 

I want to read a NMEA string(update rate 1 Hz) from a server. The original NMEA(serial, 4800 Baud) is converted by a MOXA to TCP.

Here is my minimal program, I have normally a "wait until 1000ms" timer inside.

 

tcp_labview.png

 

The problem is that the MOXA closes its port every other minute. I still can read but every one else is blocked.

Other terminal programs work. The network guy tells me that he sees a lot of traffic coming from my adress and he thinks that at some point the MOXA is confused and closes its ports.

Is there a possibility that TCP read sends a status or failure string?

 

0 Kudos
Message 1 of 3
(2,899 Views)

Hi,

 

Normally there should be no such thing. Does the traffic increase/decrease with your loop timing? That would be interesting. Unfortunately I cannot read you Screenshot, it has a too small resolution.

 

When I understand you right, you read data from a device over TCP/IP. That works, but after a few minutes, this other device goes in a kind failure state, where it does not allow requests from other IP Adresses or Ports any longer, while the LabVIEW VI continous to function?

 

Regards

René

0 Kudos
Message 2 of 3
(2,850 Views)
Solution
Accepted by topic author azavarsky

@azavarsky wrote:

HI,

 

I want to read a NMEA string(update rate 1 Hz) from a server. The original NMEA(serial, 4800 Baud) is converted by a MOXA to TCP.

Here is my minimal program, I have normally a "wait until 1000ms" timer inside.

 

tcp_labview.png

 

The problem is that the MOXA closes its port every other minute. I still can read but every one else is blocked.

Other terminal programs work. The network guy tells me that he sees a lot of traffic coming from my adress and he thinks that at some point the MOXA is confused and closes its ports.

Is there a possibility that TCP read sends a status or failure string?

 


How fast does this device send its strings? Does it simply spew data without any query command having to be send? If so your Moxa may have a problem too, as it may not know what to do with the data if there is no client connected to read it. Also your Moxa converter may have trouble to serve more than one TCP client on the same port anyhow. What should it do if several clients try to access the same port? Send the same message to each? Or send the incoming message randomly to one of them?

 

Do you get errors from your TCP Read once Moxa "closes" the port as you say? If so you should terminate your loop on any error except possibly a timeout error and reopen the port in a second outer loop until your program wants to exit. Your loop never stopping on errors will prevent the TCP Close to execute which will keep the socket open and prevent the Moxa from seeing the proper handshaking that the connection has been properly closed by the client, which will likely prevent the Moxa device from being able to accept new connections. Network communication can be tricky and one of the first things you have to learn is proper error handling. Just about any error anywhere in the network connection, except usually a timeout error on read, should be handled by closing the connection and trying to reconnect.

 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 3 of 3
(2,846 Views)