The place to discuss anything and everything about running your LiveCode on Android
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Googie85
- Posts: 227
- Joined: Tue Aug 05, 2014 10:07 am
Post
by Googie85 » Sun Aug 18, 2024 9:30 am
Hi Guys!!
I am having trouble getting a file transfer to occur. I have been going around in circles trying to get this to work but it is giving me lots of dramas!
My Client code is:
Code: Select all
global WSITE
on openStack
put "192.168.1.2:12345" into WSITE
open socket to WSITE with message "DONEA"
end openStack
on DONEA theIP
put "C:\users\user\documents\FILE.tmp" into tFile
put URL ("binfile:" & tFile) into temp["data"]
set itemdel to "/"
put the last item of tFile into temp["name"]
put base64encode(arrayencode(temp)) into tAll
write tAll & "file§" to socket theIP
read from socket theIP with message "MESSAGES1"
end DONEA
on MESSAGES1 theIP theMessage
read from socket theIP with message "MESSAGES1"
end MESSAGES1
And my server code is:
Code: Select all
on openStack
accept connections on port 12345 with message "CONNECT"
end openStack
on CONNECT theIP
read from socket theIP with message "NEWMESSAGE"
end CONNECT
on NEWMESSAGE theIP pmsg
if char -5 to -1 of pmsg is "file§" then
delete char -5 to -1 of pmsg
put arraydecode(base64decode(pmsg)) into temp
put "C:/USERS/ADMIN/Documents/RECEIVE.tmp" into tName
put temp["data"] into URL ("binfile:" & tName)
end if
read from socket theIP with message "NEWMESSAGE"
end NEWMESSAGE
I have been banging my head against the wall with this!!!
Any and all replies/suggestions will be greatly received!!
Googie.
-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Aug 18, 2024 11:54 am
Hi Googie,
Code: Select all
...
put "C:\users\user\documents\FILE.tmp" into tFile
put URL ("binfile:" & tFile) into temp["data"]
set itemdel to "/"
put the last item of tFile into temp["name"]
...
After these lines -> temp["name"] = C:\users\user\documents\FILE.tmp
I think this is the problem.
So you should either change your itemdel to BACKSLASH "\" or use the slash in the pathname:
put "C:/users/user/documents/FILE.tmp" into tFile
Hint:
LC ALWAYS uses the SLASH as a pathdelimiter internally on EVERY platform!
You only need the backslash in pathnames on Windwos if you use SHELL commands or excute a VB script.
Best
Klaus
-
SWEdeAndy
- VIP Livecode Opensource Backer

- Posts: 324
- Joined: Sat Aug 16, 2008 9:48 am
-
Contact:
Post
by SWEdeAndy » Sun Aug 18, 2024 11:54 am
base64Encode tends to insert line breaks after every 72 chars.You may try putting this after the base64Encode line:
Don't know it it helps all of your problem, but worth a try.

-
Klaus
- Posts: 14199
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Sun Aug 18, 2024 12:50 pm
This is the ANDROID forum!?
Shall I move this thread to the Windows forum?
-
Googie85
- Posts: 227
- Joined: Tue Aug 05, 2014 10:07 am
Post
by Googie85 » Sun Aug 18, 2024 9:01 pm
Sorry, it's a client/server app. Windows to Android.