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
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
Many Thanks,
Googie.