06-10-2018 05:12 AM
Hi, I need your help, I created a game that works perfectly and I want to use TCP / IP to make it playable on the network, the only problem is I do not know how to read and write on my display matrix, do you have any suggestions? How to send and read the values of a U16 matrix?
06-10-2018 12:54 PM
What do you mean by the phrases "U16 matrix" and "display matrix"?
For U16 matrix, are you talking about a U16 array of integers? You can use Flatten to String and Unflatten to string to send them over a TCP/IP connection.
06-10-2018 01:20 PM - edited 06-10-2018 01:22 PM
A matrix in LabVIEW is a special datatype and is either DBL or CDB and always 2D. I assume you have a 2D U16 array, but it is not clear at all. Can you show us some simplified code? What have you tried?
I have no idea what "reading/writing a display matrix" is and where networking fits into all this? Is these LabVIEW controls/indicators? Some special hardware?
Any data can be sent via TCP/IP. Are you planning to use TCP or UDP? Any data sent over the network is just bytes and the receiver needs to know how to recover the data from it in the correct representation. Typically you would send two items. (1) the size of the binary string as I32. (2) the binary string of flattened data. The receiver would read four bytes to get the size, then read the rest accordingly and unflatten it. Make sure to set the option to include dimension size information.
Have a look at the examples that ship with LabVIEW. Then show us a simplified version of the communication code you are trying to write.
I assume that you are writing the sender and receiver both in LabVIEW. If the receiver is a third party program, you simply need to read the documentation to see how the data needs to be formed. Even byte order might be an issue.