Flash policy

edited December 2011 in Flash (deprecated)
When I run my flash client app I have the error: "SECURITY_ERROR: Could not read security policy file!"

My code contains:
Photon.getInstance().initializeConnection("localhost", 4530, 843, "myIDApp");
//and
Security.allowDomain("*");

Maybe I need the line:
Security.loadPolicyFile("localhost/socket-policy.xml");

???

Help me.

Thanks

Comments

  • Photon has a "Policy" Application (in the deploy folder) which sends the security file on port 843.
    It should be started automatically when you use the default setup (the photonsocketserver.xml which comes with the SDK). When its started, you should have a logfile of that app: deploy/logs/policy.txt (or similar) and this logs when a policy request reached the server.

    Please check if that log file logs your requests (as "init").
    If not: check your firewalls (port 843 TCP must be open).
    Otherwise: attach an excerpt from the log here.
  • Thanks.

    The logfile deploy/logs/policy.txt don't show request "init".

    The excerpt is:
    !!!connection to server closed!!!
    Socket throws error: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Violación de la seguridad Sandbox: file:///D|/MIOS/AS3Projects/SSSMatchMakerClient/SSSMatchMakerClient.swf no puede cargar datos desde localhost:4530."]

    The machine is winxp_32, The sdk is SDK_v2-0-0-RC4. The port 843 TCP is open.
  • Can you please check the server logs and make sure it started, is running and loaded the "Policy" application correctly? In the logs (bin_win32_xp/logs/photon-instance*) you should find a line with "Adding Flash TCP listener on :0.0.0.0: 843". And in the policy log you should check if the security policy file content is logged.

    If all that is correct, you could also try to use the local machine's IP (either 127.0.0.1 or the one you got in your network). Enter it in the photonsocketserver.xml and use it in your flash app.
  • The server logs:
    2010-06-22 10:59:57,109 [1] DEBUG PhotonHostRuntime.PhotonDomainManager [(null)] - CreateAppDomain: ApplicationBase = D:\ExitGames-Photon-Server-SDK_v2-0-0-RC4\deploy
    2010-06-22 10:59:57,109 [1] DEBUG PhotonHostRuntime.PhotonDomainManager [(null)] - CreateAppDomain: PrivateBinPath = Policy\Policy.Application;Policy\Policy.Application\bin;bin_Win32_xp;Shared
    2010-06-22 10:59:57,109 [1] DEBUG PhotonHostRuntime.PhotonDomainManager [(null)] - CreateAppDomain: ConfigurationFile = D:\ExitGames-Photon-Server-SDK_v2-0-0-RC4\deploy\Policy\Policy.Application\bin\Policy.Application.dll.config

    The photon-instance logs:
    Adding Flash TCP listener on :127.0.0.1: 843 with a listen backlog of: 150 and routing to application: "Policy"

    And the policy.txt logs:
    2010-06-22 10:59:58,515 [1] DEBUG Exitgames.Realtime.Policy.Application.Policy [(null)] - Reading policy file: D:\ExitGames-Photon-Server-SDK_v2-0-0-RC4\deploy\Policy\Policy.Application\assets/socket-policy.xml
    2010-06-22 10:59:58,515 [1] INFO Exitgames.Realtime.Policy.Application.Policy [(null)] - Policy file:
    <?xml version=\"1.0\"?>
    <cross-domain-policy>
    <allow-access-from domain="*" to-ports="5055,4530" />
    </cross-domain-policy>


    I tested with other code too:
    import flash.net.*;
    Security.allowDomain("*");
    Security.loadPolicyFile("xmlsocket://" + "localhost" + ":" + 843);
    trace("Try loadPolicyFile");

    But in the Policy.txt didn't log: "On Init..." neither "Policy sent."

    I think that the policy app has not listening in the port 843.

    Help please.
  • That looks fine. It's running and the server listens to the correct port and also started the policy app. I run the same version, get the same log and it works...
    I attached a small flash test. Please try that one. It should show a changing timestamp when it connects. It connects to 127.0.0.1 and thus only on the PC where Photon is running too (could be changed in the HTML).

    Two more things: I think it could still be a firewall/networking issue. Probably it's not windows firewall but some other protection software or even hardware.
  • Aww I wanted to test that flash too to see if it works for me, but i don't see the atachemente in the forum :P

    Italo F. Capasso B. AKA "Edwood Grant"
  • The only way to run is using the version 1.6.2 of SDK.

    I don't know if it is a bug of the last version of SDK.
  • did you make sure that you updated the client sdks too?
    sounds like you potentially didn't upgrade the client sdk yet the server and thus run into the problems
  • Hehe. I'll never learn to add the attachments im writing of...
    Sorry.
  • I just tried the demos from the v5.1.0 SDK and both precompiled demos disconnect after a short time.
    We didn't notice this before, sorry.

    We will fix and update the Flash SDK asap.
  • Oh thats good news :)

    I tested your flash in the new server sdk, and it does not work for me too...
    Also created my own code, and it does not work either.. it suddenly disconnects, and after that is sends the policy file error.

    I'm gald you have found the problem... how much it would take to upgrade the client? Kinda need that in a hurry...

    Thanks a lot,

    Italo F. Capasso B. "AKA" Edwood Grant
  • I tested your flash in the new server sdk, and it does not work for me too...

    Hmm, that's still weird: For me, the tester (attached above) is working with the server from the SDK zip!

    We are looking into it and I hope I get feedback on an update soon. I'm sorry, I can't say much more at the moment :(
  • I just uploaded v5.5.0 of the Flash SDK.
    This worked out of the box for me on the RC4 server.
    The html for the compiled demos is set to udp.exitgames.com as server. Change that to "localhost" to test locally. Both demos worked instantly for me, so I hope they do the same on your machine now.
  • Hello,

    Just wanted to report that the new flash sdk works on RC4 Server without any problems :)

    Thanks a lot :D

    Italo F. Capasso B. AKA "Edwood Grant"
  • thanks for your attached. it works fine..
Sign In or Register to comment.