A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: [RESOLVED] XMLSocket Policy File Help?

  1. #1
    Junior Member
    Join Date
    Jan 2008
    Location
    Chicago
    Posts
    22

    resolved [RESOLVED] XMLSocket Policy File Help?

    It seems that my code can connect perfectly locally but does not connect from a website. I think its because of the policy file.
    I have no idea how to call a policy file using KoolMoves.
    I also have no idea where the policy link code should go.. At the beginning of the code? At the end?
    I tried:
    Code:
    System.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");
    Security.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");
    System.Security.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");
    None of these have worked and I still get a "Socket established, but connection could not be made.".
    What am I doing wrong?
    this is my whole code:
    Code:
    System.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");
    socket = new XMLSocket() 
    socket.onConnect = myOnConnect      
    socket.onClose = function (){
    statusText.text = "Connection terminated by server."
    } 
    
    if (!socket.connect("MYIP",80))       
    { 
        statusText.text = "Connection failed! Could not establish socket." 
    } 
         
    
    function myOnConnect(success)   
    {      
        if (success) 
        { 
            statusText.text="You are connected." 
        } 
        else 
        { 
            statusText.text = "Socket established, but connection could not be made."      
        } 
    }
    I know my port 80 is not blocked and my IP address is right and everything.
    THANK YOU for any help. =)

  2. #2
    Senior Member
    Join Date
    Dec 2002
    Location
    Netherlands
    Posts
    1,632
    I'm not exactly sure but as far as I know you need a socket server.
    The problem is not directly related to KM. It all has to do with Flash Player security restrictions. The correct syntax is :

    Security.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");

  3. #3
    Junior Member
    Join Date
    Jan 2008
    Location
    Chicago
    Posts
    22
    OMG. I found the problem!! Can someone delete this thread? Thanks.

  4. #4
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    I could delete it but it's better to leave it marked Resolved. You never know when someone else will need this

  5. #5
    Junior Member
    Join Date
    Jan 2008
    Location
    Chicago
    Posts
    22
    then its best I say how I fixed it..
    You don't need the link!!
    You do not need this:
    System.loadPolicyFile("http://09.isgreat.org/server/flashpolicy.xml");

    I just had to capture the packet sent by the swf with my server program to make it work.
    I used VB6.
    This is the code for VB6 to capture the policy file request and send the response needed for it to connect:

    Code:
    Case "<policy-file-request/>"
    SendData Index, "<cross-domain-policy><allow-access-from domain=" & Chr(34) & "*" & Chr(34) & " secure=" & Chr(34) & "false" & Chr(34) & " to-ports=" & Chr(34) & "*" & Chr(34) & "/></cross-domain-policy>"
    This will make it connect online!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center