Hello.
I have studied the lesson very carefully from the link above.
Such a simple and original solution I have never met anywhere, great!
But I have a small problem with generating a data package to send to one of the servers,
I need to somehow change the way the buffer is filled in the statement
astream.Write (Buffer As Byte) As Boolean
I'll try to explain with an example:
- You need to send a 27-character string to the server:
{"command":"GetDriverInfo"}
The buffer filling algorithm is as follows:
1. Convert the string length =
27 characters to Buffer (HEX)
= 1b, add zeros up to 4 bytes and get
00 00 00 1b
2. Converting the source string to Buffer (HEX) format:
7b 22 63 6f 6d 6d 61 6e 64 22 3a 22 47 65 74 44 72 69 76 65 72 49 6e 66 6f 22 7d
3. Write to the buffer (Buffer (HEX)) final result to send to the server:
00 00 00 1b 7b 22 63 6f 6d 6d 61 6e 64 22 3a 22 47 65 74 44 72 69 76 65 72 49 6e 66 6f 22 7d
in which:
- always strictly the first 4 bytes is the length of the source string (in this case 00 00 00 1b)
- then the text of the string in Buffer (HEX) format)
Judging by the video lesson, my problem is solved by two or three operators, which I regret
I don't know yet, but I hope they will help me here as always...