11-02-2023 11:12 AM
Hi
I am working on a client side application using LV17 to send and receive a small array of float numbers over TCP/IP network.
The application, using VIs from the TCP/IP palette reads the array but the received array after being type cast to single precision float does not show correct values...any suggestion would be helpful
P.S. The server application is developed in visual studio
Solved! Go to Solution.
11-02-2023 11:24 AM
Could you post all of the following to assist in troubleshooting:
1. Your current LV2017 code
2. A sample of the data taken from the TCP/IP VI as incoming data that doesn't convert as expected (make sure that this is saved as the raw binary data, probably saving it as a block diagram constant or as data in a front panel control with that value set as default to save it with a VI)
3. A list of approximately what the floating point values should equal
4. Any documentation on the server's protocol you have, if any
11-02-2023 12:45 PM
Use Unflatten From String instead of Type Cast. You have a lot more control on the conversion with the Unflatten. I have 2 strong suspicions and 1 more possibility for what is happening wrong.
Possibility: The data type of the array is a Double.
Strong Suspicion #1: The data is little-endian while LabVIEW uses big-endian. This would have the bytes be swapped and you will interpret it wrong. You can set the endianness with the Unflatten From String.
Strong Suspicion #2: The data does not have the I32 length at the beginning of the data. If the data is actually Single, this would only mess with your first data point. You can tell the Unflatten From String if the length is part of the flattened string data.
11-03-2023 09:45 AM
Thanks
I will look into the suggestions....
11-06-2023 03:56 AM
@Kyle97330 wrote:
Could you post all of the following to assist in troubleshooting:
4. Any documentation on the server's protocol you have, if any
Or the relevant few lines of the C program side that actually format the data and send it over a network socket.
11-10-2023 06:16 AM
First suspicion/tip was spot-on
Thanks