Create a C# structure that corresponds to the structure definition. This structure must not contain padding bytes (
Pack = 1
) and use members with fixed width (use
byte
,
UInt16
,
UInt32
according to the length of the fields). See
StructLayoutAttribute.Pack Field (System.Runtime.InteropServices)[
^].
Then create an instance of this structure, fill it, and send it. Sending requires converting the structure to a byte array which is a common task; just search for "c# structure to byte array".