Sub AudioStream_RecordBuffer(Data() As Byte)
Dim s As B4XSerializator
dim mdata as MyData
mdata.initialize
mdata.infostring = "TEST"
mdata.data = Data
Dim packet As UDPPacket
packet.Initialize(s.ConvertObjectToBytes(mdata), ip, port)
UDPSck.Send(packet)
End sub
note that the receiving side must know the Customtype (and needs to be a B4X App).
Another small thing: the custom type should be declared in the main module. This is required when sending types between different applications / platforms.