TCP Read in Returns Empty or No Data

Updated Mar 27, 2018

Reported In

Software

  • LabVIEW

Issue Details

I am trying to use TCP Read to return out data from my library. When I run the program as an executable, I can get the correct response but in the development environment, the data is empty. What am I doing wrong?

Solution

When using the TCP Read VI, the mode can be set to Standard, Buffered, CRLF, or Immediate. Each of these modes have different behavior of the read operation depending on the bytes to read or timeout listed in TCP Read Function.

The default value for Bytes to Read is 0, so the VI is looking for 0 bytes and is not throwing an error because if there are no bytes coming in, it is reading the expected value. With the standard mode, the program will wait until all bytes you specify in bytes to read arrives which in this case is 0.




 

Additional Information

In immediate mode-  if nothing is connected to the Bytes to Read, the function will not report a timeout error. It is very easy to assume that you do not need to wire up this node since you are in Immediate mode. When using TCP Read in Immediate mode, the Bytes to Read should be set to a large number such as 1024 because the function will read immediately FROM the number of bytes specified at Bytes to Read.

With using CRLF mode, you must include a carriage return (CR) and linefeed (LF) to the function in order to get the data. 
 

WAS THIS ARTICLE HELPFUL?

Not Helpful