I have a Flex app that uses an XMLSocket to talk to a socket
server on the local machine (localhost).
For various reasons, I cannot set up a socket server on port
843 (because the socket server is embedded in a desktop app, and
not all users have root access which is required to listen on this
port). BTW, if I *do* run that server on port 843 ,everything works
fine. But as I say it is not an option for deployment.
My java socket server is a little bit slow, because for every
new request it starts a new thread. The result is:
...and I have it run *NOT* on port 843 but on the port my
socket server runs on (port 4444), everything works just fine.
If I introduce a delay into the python server, having it wait
5 seconds before serving the policy file, I get the error above.
Therefore I can say conclusively that the timeout is the
problem. Is there any way to make the flash player wait a little
longer than 3 seconds to receive the policy file? I can try and
speed up my socket server code but there is no guarantee that it
will always run quickly enough on everyone's machine.
Hope someone can help. This is an instance where Adobe's
socket security policies are so restrictive that I actually cannot
use a socket at all. ;-(
I got this to work....I'm still not exactly sure what the
deal was. Something in my policy server implementation differed
enough from the python implementation that the flash player's
behind-the-scenes grabbing of the policy file didn't work. I think
it qualifies as a bug in the flash player but I don't have time put
all the details together now.
What I did to get it to work was:
1)Used the policy server implementation from here:
http://www.broculos.net/tutorials/how_to_make_a_multi_client_flash_java_server/20080320/en 2) Modified it to have the policy server running on port
3) Slightly modified the policy file sent out by this server,
to add this line above the "allow-access-from" line:
4) Changed my flex code to do this before trying to connect
to the socket: