LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Read w/ #bytes=4 returns wrong data.

On an initial TCP Read to a just-open connection, I can read any number of bytes, always getting the first n bytes from the arriving data. Except when I try to read 4 bytes! Then I get 4 bytes, but they're the seventh through ninth bytes, not the first four. Haven't found any other number that gives problems - 1,2,3,5,6,7,8,16,40,1020,etc. all work fine. Ideas?
0 Kudos
Message 1 of 3
(2,705 Views)
I have to be missing something here!

You can read a "-1" bytes OK?

Please post something for us to look at.

A HEX 04 is an EOT but that should not be coming into play here.

Willing to help,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 3
(2,705 Views)
You may want to try runnig the Data Client and Data Server example VIs which ship with LabVIEW and see if they work on your system. The Client example actually reads in 4 bytes every time. I ran it and it works fine, so if yours exhibits the behavior you've been seeing, then the problem could be with your connection. Otherwise, if the example does work, then it could be somewhere in your code. Let us know what you find.
J.R. Allen
0 Kudos
Message 3 of 3
(2,705 Views)