1 Reply Latest reply on Nov 12, 2008 6:12 PM by dandante

    Socket Server timeout serving policy file

      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:

      Warning: Timeout on xmlsocket:// (at 3 seconds) while waiting for socket policy file. This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
      Error: Request for resource at xmlsocket:// by requestor from http://localhost:8080/play/play.swf is denied due to lack of policy file permissions.

      However....if instead of my java server, I substitute the python server, available here:

      ...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. ;-(
        • 1. Re: Socket Server timeout serving policy file
          dandante Level 1
          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:
          2) Modified it to have the policy server running on port 6667.
          3) Slightly modified the policy file sent out by this server, to add this line above the "allow-access-from" line:
          + "<site-control permitted-cross-domain-policies='master-only'/>"
          4) Changed my flex code to do this before trying to connect to the socket:

          Hope this helps someone....