From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting TCP Read timeout value?

How do I choose a timeout value for a TCP read function?

 

I'm receiving data from a server at a rate which varies between 40 and 140 Hz (normally 120 Hz), there is no handshaking and at any set transmission rate it appears that the network load causes the rate to fluctuate slightly.

 

All I have been able to do so far is plot a frame number that is received in my data and fiddle with the buffer mode and timeout until I get the least dropouts. At 120Hz 5ms works best with a standard buffer, surprisingly 8ms is poorer.

 

I am using a producer consumer loop with a queue and some interpolation to make up for the loss of data. 

 

This is very hit and miss so I'm sure there's a proper / better way to do this!

 

 

0 Kudos
Message 1 of 2
(2,574 Views)

If you are using standard mode, then the read function should return any partial data, but will report an error out.

 

You may want to look at the functions that you call after the TCP read. I think that the enqueue function will NOT enqueue data if there is an error in.

 

There is a function you can use to clear TCP timeout errors. You could use this to allow you to enqueue partial data to your consumer loop.

 

vi.lib\addons\internet\utils\tcputil.llb\No Time Out Error.vi

 

Note that it will be up to your consumer code to identify your 'frames' for proper decoding.


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

0 Kudos
Message 2 of 2
(2,552 Views)