This content has been marked as final. Show 4 replies
it can stay in listenmode and it can connect on ports lower than 1024
so use flashsockets.
Thank you for reply.
I readed the flash documentation for XMLSocket and in fact you can download a policy file that tweaks a little the security restrictions.
For to comunicate to ports lower than 1024 you need to call System.security.loadPolicyFile(), you know a method to call this function from Lingo?
Another thing is the listen mode (socket server), i re-readed the page and didn´t find this part.
This is a framscript that we used to test socket communication.
Our socket server replied everything you sent to it.
property pStartTime, pPings, pState
on beginSprite me
member("debug").text = RETURN & "Starting..." & RETURN
gSock = newObject("XMLSocket","")
me.debug("Connecting to socket")
setCallback(gSock, "onConnect", #onConnect, me)
setCallback(gSock, "onData", #onData, me)
setCallback(gSock, "onClose", #onClose, me)
pState = #wait
on onConnect me, tSock, tOk
me.debug("Connected to socket")
me.debug("Sending first PING")
pStartTime = the milliseconds
on onData me, tSock, tMsg
tMsg = value(tMsg)
sprite("p1").locH = sprite("p1").locH + 1
sprite("p2").locH = sprite("p2").locH + 1
pState = #sending
on onClose me, tSock
on endSprite me
on exitFrame me
case pState of
sprite("p3").locH = sprite("p3").locH + 1
go to the frame
on debug me, txt
put TAB & txt & RETURN after member("debug")
When you have opened a socket you can send data from both directions.
The tricky part is that youll have to write a server app that will reply the policyfile over socket.
Thanks a lot,
No doubt that the way for load the policy file will help to re-define interdomain and ports restrictions. You help me a lot.
Another thing is the listen mode. I mean a socket server, which cannot be implemented with XMLSocket. A discover several XMLSocket server xtras. So i believe is not that simple to implement with XMLSocket objects.
Fortunately, i recently compiled a win32 app, which listen in the specific port of the machine and accepts connections from clients (that already know the IP:port of the service). I tested with a demo app developed with XMLSocket and works fine.
the next step is to port the app to a xtra, define some apis, and will ready to program an aplication server.