Hi.
i get a lot of data (binary) over a tcp connection. The Data comes with the byte Array.
This Array then i append to a String-"buffer" like:
after this i parse the string and want to extract the informations. This are encodet like:
<Unsigned Byte><Unsigned Byte>[<Data Byte(s)>]
as example (native Hex Values)
00 04 54 65 73 74
The first 2 bytes are the len of the message, the last are the message ("Test") itself.
So .. my first try was to create a lot of arrays where the data sored into and parse, use temp array, redim, merge remove, extract and copy the stuff around the array's. but, i can't believe that this are so compilcated.
So i want to manage this a lot ... smother .. with a simple string manipulation with the build-in string-commands.
But, i have the problem with the encoding's. How can access the native Byte by index-number in the String (like a pointer-access)?
How i can do this? (i know, that a function exist what this "protocol" use, but i can't use it. This here is only a example. My Protocol is more compilcated and the "existing" isn't usable in my case)
JimJim
XUN
i get a lot of data (binary) over a tcp connection. The Data comes with the byte Array.
B4X:
Sub Network_NewData(Buffer() As Byte)
End Sub
This Array then i append to a String-"buffer" like:
B4X:
MyString = MyString + BytesToString(Buffer, 0, Buffer.Length, "Windows-1252")
after this i parse the string and want to extract the informations. This are encodet like:
<Unsigned Byte><Unsigned Byte>[<Data Byte(s)>]
as example (native Hex Values)
00 04 54 65 73 74
The first 2 bytes are the len of the message, the last are the message ("Test") itself.
So .. my first try was to create a lot of arrays where the data sored into and parse, use temp array, redim, merge remove, extract and copy the stuff around the array's. but, i can't believe that this are so compilcated.
So i want to manage this a lot ... smother .. with a simple string manipulation with the build-in string-commands.
But, i have the problem with the encoding's. How can access the native Byte by index-number in the String (like a pointer-access)?
B4X:
Print MyString[3] 'for the 4. native unsigned Byte in the string
How i can do this? (i know, that a function exist what this "protocol" use, but i can't use it. This here is only a example. My Protocol is more compilcated and the "existing" isn't usable in my case)
JimJim
XUN