I am receiving a UDP packet with a structure written in C and it looks like:
I managed to receive the datagram and display the data with a UDPSocket. And I defined a structure with the same fields and byte lengths. But how can I add the received data to my (local) struct in xojo?
[code]Dim udpDataGram As DataGram
Dim myStruct As UDPStruct //my defined structure with same fields
udpDataGram = UDPSocket1.Read
TextAreaUDPPacket.Text = d.Data
myStruct = ???[/code]
myStruct.Stringvalue(littleEndian) = udpDataGram.Data
littleEndian is a boolean to tell if the struct is littleEndian or not.
I guess you can use pragmas to check (#TargetLittleEndian)
Thank you for the answer. I can compile an run the application and see the data.
But something is strange: first characters seems to be the hostname in udpDataGram.Data. I don’t send the hostname in the data packet. I have to investigate a little bit more (wireshark)
FYI: hostname is not included in udpDataGram.Data. Other programmer who wrote the C part under Linux included the hostname without telling me that.
Thank again for helping.