Hi
i try to use udp socket and want send data from a "struct" as a Header
so i created a Type. For me would be better, i can use a List for flexible data to send
and load the data to the list ( so i have for example DataTest2 in this type )
also for me would be ok, if this data be a byte array ( like the DataTest1 )
My Base Question is, how i can send this "struct" with the UDP.Send(Packet)
Cause Packet must be Byte() but i get an error for convert the "struct" to byte().
my try was this:
Thanks for any help.
Regards
espi
i try to use udp socket and want send data from a "struct" as a Header
so i created a Type. For me would be better, i can use a List for flexible data to send
and load the data to the list ( so i have for example DataTest2 in this type )
also for me would be ok, if this data be a byte array ( like the DataTest1 )
My Base Question is, how i can send this "struct" with the UDP.Send(Packet)
Cause Packet must be Byte() but i get an error for convert the "struct" to byte().
B4X:
' global Variable
Type Datagram ( Startbyte As Byte, _
CMD As Byte, _
DataTest1 As Byte(1024), _
DataTest2 As List, _
Endbyte As Byte)
my try was this:
B4X:
Dim SendData1 As Datagram
SendData1.Initialize
Dim MyData As List
MyData.Initialize
MyData.AddAll(Array As Byte(0xFF, 0xFB, 0xFC))
SendData1.Startbyte = 0x9C
SendData1.CMD = 0xDD
SendData1.DataTest1 = "LINE A".GetBytes("UTF8")
SendData1.DataTest2 = MyData
SendData1.Endbyte = 0x33
Dim Packet As UDPPacket
Packet.Initialize(SendData, PanelIP, PanelPort)
UDPSocket1.Send(Packet)
Thanks for any help.
Regards
espi