Jump to content

unflattening data from UDP packets


Recommended Posts

I have UDP data packets based on a cluster containing 2 I32s and 5 SGL values: call this cluster type X. The data packet itself is an array of 16 elements where each element is composed of 2 I32 values, followed by 4 separate clusters of type X, and this is followed by an array of 12 elements of the type X cluster. So this total packet size is 7296 bytes. I have previously worked with data packets containing an array of 32 SGLs or DBLs and used the unflatten VI to recover the array as well as reconstruct data packets consisting of data for a simple, non-nested cluster. I tried making a template of the data that I wanted to retrieve from the data packet, but that does not seem to work at all because of the complexity of the data in the packet. Anyone have an ideas how to parse out this data?

Link to comment

I have UDP data packets based on a cluster containing 2 I32s and 5 SGL values: call this cluster type X. The data packet itself is an array of 16 elements where each element is composed of 2 I32 values, followed by 4 separate clusters of type X, and this is followed by an array of 12 elements of the type X cluster. So this total packet size is 7296 bytes. I have previously worked with data packets containing an array of 32 SGLs or DBLs and used the unflatten VI to recover the array as well as reconstruct data packets consisting of data for a simple, non-nested cluster. I tried making a template of the data that I wanted to retrieve from the data packet, but that does not seem to work at all because of the complexity of the data in the packet. Anyone have an ideas how to parse out this data?

The flatten and unflatten functions should be able to handle any data type. You should be able to make this packet into a typedef cluster and use it to flatten data for sending over UDP and unflattening data received from UDP. Maybe if you post some code or diagram screenshots we could see where you are going astray.

Link to comment

I have UDP data packets based on a cluster containing 2 I32s and 5 SGL values: call this cluster type X. The data packet itself is an array of 16 elements where each element is composed of 2 I32 values, followed by 4 separate clusters of type X, and this is followed by an array of 12 elements of the type X cluster. So this total packet size is 7296 bytes. I have previously worked with data packets containing an array of 32 SGLs or DBLs and used the unflatten VI to recover the array as well as reconstruct data packets consisting of data for a simple, non-nested cluster. I tried making a template of the data that I wanted to retrieve from the data packet, but that does not seem to work at all because of the complexity of the data in the packet. Anyone have an ideas how to parse out this data?

What is the source of your UDP data? Is it a LabVIEW application, or a custom device?

Link to comment

What is the source of your UDP data? Is it a LabVIEW application, or a custom device?

Good observation. If it is not LabVIEW the arrays will throw a wrench into the wheels. LabVIEW expects for any array in a bytestream an int32 telling it how many elements will follow. For creating a fixed size array you have to resort to a cluster of that type with as many cluster elements as you want to have fixed size array elements.

Link to comment
  • 3 weeks later...

I discovered a nice little string function where the byte stream is converted to byte values which made comparing WireShark's values and what flatten to string and unflatten to string were really doing behind the scene gave me all the information that I needed to do the parsing using these flattened and unflatten functions correctly. Incidentally, I am using both tcpip and udp messages to communicate with embedded software done using WindRiver so I am not talking to any NI hardware at all, but I am providing the GUIs needed to run the remote microcontroller using these protocols to control the data acquisition and processing at the other end of the system. Thanks for the comments.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.