PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → [WM23 and WD21] SocketWrite from iOS and SocketRead from Service Windows
[WM23 and WD21] SocketWrite from iOS and SocketRead from Service Windows
Débuté par ARV, 22 fév. 2019 20:15 - 1 réponse
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 22 février 2019 - 20:15
Hi all

I have this issue with the following set up

I have windev mobile 23
and Windev 21

on Windev Mobile 23 I have a project on iOS
there I use SocketConnect to connect to my server where I have the service on Windev 21
the message I send it's like this
num is int
messageA,MessageB is string
Message is buffer

Message = num+messageA+MessageB

I use this to put it on SocketWrite on iOS

Then on Windev 21 service project when I process this message it only gets me the first letter of the buffer
Message:
123,A,A
Message Service:
1

this occure because some conflicts on Ansi and Unicode it's like the message it's on Unicode and I want to show Ansi
but then again I changed the project string to Unicode

just to be sure I delcared a variable on Unicode string and nothing seems to work.
the way I read the socket it's with a buffer then I asing on a string what I read on the buffer.

any ideas?

--
Best Regards
ARV
Membre enregistré
498 messages
Popularité : +8 (8 votes)
Posté le 23 février 2019 - 16:01
Hi all

I finally understand what is happening

Android and PC have the same UNICODE but iOS (iPhone) doesn't

so all I need to do it's just to transform to UTF8 with StringToUTF8
all of my strings of iOS, Android and PC

send it iOS and Android on UTF8 to PC
Then on PC transform UTF8ToString to handle the info then send it like StringToUTF8 to Android and iOS
Then do the exact same thing like PC transform UTF8ToString and that's it I can read all the info.

The same thing it's with CryptStandard and UncryptStandard with iOS and Android or PC
you need to transform every string to UTF8 to use CryptStandard
do not do StringToUTF8(CryptSTandard) because it's wrong keep it on buffer the result of CryptSTandard just the buffers of the function transform in into UTF8

then on UncryptStandard you need to use it like this:
//Remember the buffer needs to be on UTF8
UTF8ToString(UncryptStandard(bufMessage,bufPass,"I USE DEFAULT BUT SEARCH SOMETHING THAT COULD BE GLOBAL FOR PLATAFORMS")

//CryptStandard
bufMessage is buffer = StringToUTF8("MESSAGE")
bufPass is buffer = HashString("USE A GLOBAL FUNCTION HERE FOR WHAT YOU NEED",StringToUTF8("PASSWORD")
bufCrypt is buffer = CryptStandard(bufMessage,bufPass,"I USE DEFAULT BUT SEARCH SOMETHING THAT COULD BE GLOBARL FOR YOUR PLATAFORMS")

then you will see the message normaly

buf if you send messages from socket on iOS to PC or Android then all you need to do its on the part of the string convert it to UTF8
then on the other side transform UTF8ToString and everything works great!.

Good Luck my fellows developers.

--
Best Regards
ARV
Message modifié, 23 février 2019 - 16:07