File Transfer - JPG

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

File Transfer - JPG

Post by Googie85 » Wed Jan 17, 2018 5:44 am

I have a client/server application that I have been having some problems with. The JPG keeps on getting corrupted and will not work. Here is my code:-

Server.

Code: Select all

global flower

on openStack
   accept connections on port 12345 with message "connectionMade"
   put "" into field "Edit"
end openStack

on connectionMade pIPAddress
   put pIPAddress&CR after field "Edit"
   read from socket pIPAddress until return with message "newMessage"
 end connectionMade
 
 on newMessage theIP theMessage
    put theMessage after flower

    if flower contains "EXPLORE" then
       replace "EXPLORE" with "" in flower
  put base64Decode(flower) into URL "file:tester.jpg"
           put "" into flower
    end if
           read from socket theIP until return with message "newMessage"
 end newMessage
Client.

Code: Select all

local lSock = "192.168.15.189:12345"

on openStack
  newConnection
end openStack

on newConnection
  if lSock is not among the lines of the openSockets then
    open socket lSock with message "CONNECTED"
    send "newConnection" to me in 15 seconds
  end if
end newConnection

on CONNECTED theIp
   read from socket theIp until return with message "newMessage"
end CONNECTED

on newMessage theIp theMessage
   
   if theMessage = "Download" & return then
      answer "Download"
      put the base64encode of URL "binfile:c:\windows\temp\ScreenShot.jpg" into blah
            put "EXPLORE" after blah
      write blah to socket "192.168.15.189:12345"
      read from socket theIp until return with message "newMessage"
   end if
end newMessage
All help would be very greatful!!!

Many Thanks,

Googie.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7228
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: File Transfer - JPG

Post by jacque » Wed Jan 17, 2018 6:39 pm

URL "binfile:c:\windows\temp\ScreenShot.jpg"
The slashes point the wrong way, for one thing. LC only uses forward slashes in file paths. Also, you probably know this, but if the app is going to be built for Android, you can't use hard coded paths like that. You may need to add some parentheses to the URL designation too, but see if changing the slashes works first.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Android Deployment”