asked on
Public Structure udtNetflowPacket
Dim Header() As Byte
Dim Flowset()() As Byte
Dim FLowsetType() As Integer ' 1=template, 2=data
End Structure
'Declare an instance of my structure
Dim stcNetflowPacket As udtNetflowPacket
'Define the header
Dim byHeader(20) As Byte 'Header is 20 bytes long
'Copy the header
byHeader = New Byte(19) {}
Buffer.BlockCopy(byPacket, 0, byHeader, 0, 20)
stcNetflowPacket.Header = byHeader
intCurrentByte += 20
Dim intFlowsetLength As Integer = 0
Dim byFlowsetLength(2) As Byte
' This gets the length in bytes that I want to copy as an integer
byFlowsetLength = {Buffer.GetByte(byPacket, intCurrentByte + 3), Buffer.GetByte(byPacket, intCurrentByte + 2)}
intFlowsetLength = BitConverter.ToInt16(byFlowsetLength, 0)
'Copy the flowset
Dim byFlowset(intFlowsetLength) As Byte
byFlowset = New Byte(intFlowsetLength - 1) {}
Buffer.BlockCopy(byPacket, intCurrentByte, byFlowset, 0, intFlowsetLength - 1)
stcNetflowPacket.Flowset(0) = byFlowset