LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Losing packets TCP

Hello,

 

I'm using an aplication based in Agents architecture. The application use many agents (vi), and one of them is the communication agent. On the other hand I have external devices (boards) that communicates with application (server - 192.168.1.14) via TCP. The boards are the clients.

 

I 've done some tests to know if I read all packets... and I find that I lose packets. In this example I've only use one client (192.168.1.100) and I had not recived messages nº 273 and 275 (see shark2.jpg).

 

I don't know where is the problem. I attached Communication Agent. Is the problem on TCP functions timeout?

 

 

 

Vicen

LV2010 on WinXP/7

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

Looking for Forums nathand wrote: (http://forums.ni.com/t5/LabVIEW/tcp/td-p/2157942/highlight/true/page/2)

 

"The timeout for the first read should be as long as necessary; it might be forever (-1) if that's appropriate for your application.  You can force a TCP Read to terminate even if it's waiting forever by closing the TCP connection, which is often useful in a server: let the read wait forever, and if the user exits the application, close the connection to cause the Read to finish (it will return an error but no data, of course).

 

The timeout for the second read can be short, I'd suggest in the range of 10-100ms.  If your packets are relatively small and infrequent, even a 0ms timeout will likely work because the length and data should arrive together.  If you're sending large amounts of data over a slow network and are seeing timeout errors, increase the time."

 

Do I need to change values of my timeout? Now the timeout values are 100ms.

0 Kudos
Message 2 of 3
(2,199 Views)

I would probably use a longer timeout for your initial read. You should check to see if you read partial data and buffer that. As long as your protocol is fairly robust in terms of your parsing the data you can buffer partial reads and append new data to that. In fact, you could have a simple task which does nothing but read data and queues it for another process to actually parse and process. It really depends on how quickly data is being streamed as to which approach is best.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 3 of 3
(2,186 Views)