I am working on a client/server system and I want to pass an array of clusters from a LabVIEW server to a LabVIEW client on another computer. Any of these three flatten/unflatten strategies should work, which one is most robust? Since TCP is supposed to be lossless, it shouldn't matter, but I'm sure that some people have had better success with one method than the others.
Solved! Go to Solution.
String is basically illegible to the naked eye if you ever need to do debugging via network traffic snooping, so I would say that makes it "less robust".
JSON and string flattening basically explode and stop working if there's ever a type definition change on one side not matched on the other. Not a problem if you can be sure you always update the client and server models at the same time.
JSON's "flatten" function doesn't work for classes despite having an "anything" input, so if you ever want to pass classes instead of clusters, no luck.
LabVIEW's XML encoding for classes includes version control that can read old versions of the class, allowing for a partially out-of-sync updating, if some classes only are sent one way.
So I would give the edge to XML here.
Edit because I forgot another alternative:
If you use the INI file format and just send that over TCP/IP, you don't get errors until you look for a value that doesn't exist, making mismatched versions even less of an issue.
OpenG has VIs in it that can read/write clusters as INI files, to partially automate the process.
anytime NI would like to support protobufs, please go ahead. Creating a protobuf compiler for LV is big task, but if anyone can do it it's NI