I have a LabView vi that takes a string and unflattens it into an array of doubles. Some of those doubles are then used as return variables for a dll that I am using in C#.
Now some of the values that get returned do seem off to me however. For example:
When I should get 10.105(...) as a return value I do get 10.105(...)
When I should get 10.305(...) as a return value I do get 10.123(...)
When I should get 10.405(...) as a return value I do get 10.123(...)
When I should get 10.505(...) as a return value I do get 10.505(...)
Is that some sort of conversion error and how can I debug or solve this?
Could you post some of the reply strings? Then we can tell if its a conversion issue on the LabVIEW-side or not.
Is it the "receive.txt" that is read by LabVIEW? It has floats as input but in LabVIEW you flattn from an array of doubles. We don't know what the AppendAllText is doing. If you can supply the C#-project, we might be able to help there too.
Nothing is read by labview.
The receive.txt is me trying to debug on a machine that has no visual studio installed. It just prints the values that get returned via the labview dll into a txt file.
The return values are the floats - those are already wrong for some of the numbers and correct for others.
I can't look into the TCP string as that is just gibberish and needs to be unflattened via the labview dll first.
Also I tried changing the supplied value from a string to a numeric array. The dll now says that it wants a byte[*] type in C# - how do I generate that? There is like no documentation on that type.
You definitely create a problem. Inside the VI you use Unflatten from String. This node expects a binary byte stream, not a text string. So the bytes need to be exactly correct.
However on the Receiver side of your C# code you receive a byte array and just for fun decode it into an UTF 8 string. Encoding ONLY is useful for human readable strings and then you need to know what the other side used as encoding. Here you transfer obviously binary data, probably send from a LabVIEW program after it is run through Flatten to String. Absolutely no encoding is allowed on binary data as that can change the byte values.
So the byte array received from ReceiveServer.GetStream().Read() needs to be passed as Byte Array to the LabVIEW VI and in the VI you can do a Byte Array to String node, which in LabVIEW is not applying any encoding. The Resulting String you can then pass to the Unflatten from String.
This is the same as I mentioned in your other thread, only here you seem to do the reverse of what you tried there.