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
Sending arrays through sockets, from different platforms and different system languages
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Sending arrays through sockets, from different platforms and different system languages
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
Re: Sending arrays through sockets, from different platforms and different system languages
I just found out that I cannot do this (on windows it does not work):
So i guess there is not other mean that go with a repeat for each key and each content
Code: Select all
put ArrayEncode(tArray,"7.0") into tText
put IsoToMac(tText) into tText
put MacToIso(tText) into tText
put ArrayDecode(tText) into tFinalArray
Trevix
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
OSX 14.3.1 xCode 15 LC 10 DP7 iOS 15> Android 7>
-
- VIP Livecode Opensource Backer
- Posts: 7215
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Sending arrays through sockets, from different platforms and different system languages
ArrayEncode changes the text to binary. Do the ISO conversion first, then ArrayEncode it. Reverse the process to decode.
But LC now handles unicode automatically so you shouldn't need to use ISO conversions at all.
But LC now handles unicode automatically so you shouldn't need to use ISO conversions at all.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com