hi.
im working on a game project that uses sockets for sending and receiving data. client games are unity but still server is c sharp asp.
as we all know on sockets you just can send and receive bytes. so what is best for me to send and receive multi varibles like speed direction and...
i think best way is to concat all varibles to an string and convert that string to a byte and after that send and un concat the string other side. but maybe its notthe best way and there is other ways specially in c sharp. here is my psudocode that i think can work well:
int position,rotation;
string data=concat(data,position,rotation);
byte[] byteBuffer = Encoding.ASCII.GetBytes(data);
socket.send(bytebuffer);
i think this way can not be efficient enough. can i find some other way? thank you