Converting multiple integers into an integer that represents their byte arrays combined?
I'm trying to replicate what this C# code is doing:
It is using .NET features, namely BitConverter.GetBytes, to convert the integers "command", "versionNumber" and "payloadSize" into byte arrays, then combines them into one byte array, and sends that.
In UE4, to send things over TCP the Socket->Send functionality is used. However, it takes a uint8* as a parameter for the data it is sending, and not a byte array. I could simply use uint8(myInteger) to convert that "command" integer into a thing that is sendable, but I need to combine the three integers before sending them, like what System.Buffer.BlockCopy does, so that the raw binary data sent by TCP would be the same as the one sent by that C# script.
How do I do that?
p.s. and how do I determine the size of the data to send? I'm an absolute noob in this entire networking/tcp/whatever thing.
EDIT: byte is apparently non-existent in UE4, and i need to use chars instead. how? please help I'm drowning here
uint8* is exactly array. In C++ any pointer can function as array and there really not array type, when you place  at the end it will read next byte (since uint8 is equivalent of byte) in next memory address. Thats why raw byta functions require you to input size of what he need to read, because you can't read size of array in C++ (or else you program it to do so, thats why we have TArray). In C++ it will look like this:
There you got, but in C++ you can make it a lot nicer, just make struct, because C++ place them in order (if i'm not mistaken, but i seen lot of binery protocol codes do that)
Follow this question
Once you sign in you will be able to subscribe for any updates here