Game Development Community

String over 255 characters

by Daniel Portugal de Lourenço · in Torque Game Builder · 09/01/2008 (4:45 pm) · 2 replies

Hello,

Does anybody know how to send strings from server to client and vice-versa with more than 255 characters?

I need to send a long string from my server to the clients, but the clients only receive the first 255 characters.

Oh, and I should send the string in one variable, not divided in many. It seems each variable holds a maximum of 255 characters when it is being sent over. I will probably need to edit some C++ files, right?

Can anyone give me directions?


Thanx!

#1
09/01/2008 (7:23 pm)
What i did was to break up the strings into 255 size chunks, and send them over different commandToClient commands (e.g. send1, send2...) and a final send command telling the client all the chunks were sent. The final command tells the client to check for the recieved vars and schedules itself to run again if any of the vars are empty. Once the all vars are not empty, concat them into a single var.

Not the most graceful way but it works for me. Hope this helps.
#2
09/02/2008 (10:25 am)
Thank you, Michael. It works!

I realized the chunks can also be sent in only one commandToClient, using parameters like %send1, %send2, etc (than it is possible not to use the verification, since all variables are being sent in one command). *Of course, if the string gets TOO big, it wouldn't work because too many parameters would be needed.

This IS dividing the string in many variables, but it might be better than raising the 255 capacity: 255 is FF in hex and to raise this number we need much more memory, I think (FFFF would be around 65000). In bin, FF demands 8 digits (11111111), but FFFF demands 16 (1111111111111111)! I'm definitely not sure, but I think it works this way.

So, thanks again!