Sending arrays through sockets, from different platforms and different system languages
Posted: Tue Jul 24, 2018 5:11 pm
I went back to an App of mine, Tcal, started with LC 5.5, and developed now with LC 8.1.10.
The App is made of a standalone server and several standalone clients.
Each clients writes to the server and the server respond to each clients.
Clients can be OSX or Windows. The same for the server. Each one can also run with different System settings (different part of the globe) with accented chars, etc.
It was working fine, but now I decided to change the the data format that is transmitted through sockets, going from "|" delimited text to multi-key arrays (like tArray["some"]["other"]), because of much easier internal handling.
I need suggestions on how is better to pack the data that get sent trough sockets.
I use to handle the different platforms simply using a "IsoToMac" and "MacToIso" (everything arrived as Mac formatted text and then eventually converted) but now with array, things get a little more complex.
Because of the use of array, I need ArrayEncode and ArrayDecode before transmission and on receive.
(I may also have to "Base64Encode" and "Base64Decode" the data, to ensure safety).
With text I could just Base64Encode(IsoToMac(TheData)) everything before transmission.
With Array, while I can ArrayEncode and Base64Encode each array on the transmit script, I must decide where in my scripts to do the IsoToMac(each key and content of the array)
Any suggestion on how to deal with these problems? Speed problems?
I tried to read about Unicode (http://livecode.byu.edu/unicode/unicodeInRev.php) but i simply don't grasp it (sigh)
Trevix
The App is made of a standalone server and several standalone clients.
Each clients writes to the server and the server respond to each clients.
Clients can be OSX or Windows. The same for the server. Each one can also run with different System settings (different part of the globe) with accented chars, etc.
It was working fine, but now I decided to change the the data format that is transmitted through sockets, going from "|" delimited text to multi-key arrays (like tArray["some"]["other"]), because of much easier internal handling.
I need suggestions on how is better to pack the data that get sent trough sockets.
I use to handle the different platforms simply using a "IsoToMac" and "MacToIso" (everything arrived as Mac formatted text and then eventually converted) but now with array, things get a little more complex.
Because of the use of array, I need ArrayEncode and ArrayDecode before transmission and on receive.
(I may also have to "Base64Encode" and "Base64Decode" the data, to ensure safety).
With text I could just Base64Encode(IsoToMac(TheData)) everything before transmission.
With Array, while I can ArrayEncode and Base64Encode each array on the transmit script, I must decide where in my scripts to do the IsoToMac(each key and content of the array)
Any suggestion on how to deal with these problems? Speed problems?
I tried to read about Unicode (http://livecode.byu.edu/unicode/unicodeInRev.php) but i simply don't grasp it (sigh)
Trevix