Efficiently Parsing Large TCP Byte Array into UDT in Ignition

Dear Everyone,
I receive a TCP message as a byte array in Ignition and use a gateway tag change script to parse it into individual fields. These fields are then written to tags organized in a UDT. The parsing logic works, but it's not efficient when the message size is large (e.g., several kilobytes). Is there a better way to parse and map the byte array directly to a UDT structure?

Thank you in advance for your support!

What's inefficient about it? How are you measuring efficiency?

1 Like

If you're writing each tag individually it could be slower compared to building arrays of tags and values, then at the end of parsing a message, write them all at once with a single call.

1 Like

If you aren't wrapping the byte array in a java.nio.ByteBuffer setting endian order, then using its accessor methods, you are doing it wrong.

1 Like

Thanks for all response,
I'm looking for a more efficient solution to parse 8192 bytes of data from a TCP driver into a UDT instance. My current method is time-consuming and hard to maintain, even without considering performance. Is there a way to define a data format like a struct first, then parse all the MessageBytes into it?

Thanks for your solution, I’ll give it a try.

You can do this with my EtherNet/IP module's Host Device driver's scripting support.

/shameless plug

Hmmm. Probably can use the module unlicensed for pure data type and structure manipulation.

1 Like

It seems like it's a driver for EtherNet/IP. Is it suitable for use with the TCP Driver? Or can it be used for the purpose of creating struct data?