1 Reply Latest reply on Apr 14, 2011 6:03 PM by ChrisH

    XMLSocket Connection Problem to localhost


      I All,

      I'm having a problem with connecting to localhost with a Flash XMLSocket and a PHP socket server script.


      The scenario is this.

      Local machine running IIS (localhost).


      I can run the PHP script which initialises the listening port.


      I have checked that this port is open and running from the command prompt (netstat -a). Which shows the port as open and listening so teh PHP side of things appears okay.


      I can Telnet to the designated listening port on localhost using hyper-terminal, which connects successfully.


      If I test publish my file (ctrl+enter) whilst the PHP script is running, it connects successfully and operates as expected.


      If I run the SWF just from the local HDD outside of Flash I receive a security warning. This indicated to me I have a sandbox / security issue.


      To rectify this, in the first line of the AS I included the line:



      ...to allow it to run with permission from its current location, which is at the root of localhost.


      I have also tried the wildcard and the explicit local host addresses e.g.



      I have tried disabling my firewall, but still can't ascertain why it will only run in the localTrusted sandbox and nothing else.


      I'm writing the sand box type out to a dynamic text box on the stage with:

      sandbox.text = System.security.sandboxType;

      So I know what it is running in at any particular time. When I open it from localhost via a browser I can see that it is running in the “remote” sandbox, so I would have thought that the allowDomain would have allowed the connection remotely.

      Unfortunately other than in the localTrusted sandbox, all server connections fail.

      Any suggestions would be greatly appreciated.


      Best Regards


        • 1. Re: XMLSocket Connection Problem to localhost
          ChrisH Level 1

          Hi All,

          As an update, I have also tried to load a cross-domain policy file to allow access, but still having no luck connecting outside of the local trusted sandbox, inside flash after a publish preview.  When I go to the HTML file on localhost the server connection fails, every time.


          To my flash file I added the AS::





          And in the root directory of my localhost I added:the file crossdomain.xml, containing:


          <?xml version="1.0" encoding="iso-8859-1"?>
          <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> 
          <!-- Policy file for xmlsocket://socks.mysite.com --> 
              <allow-access-from domain="*" to-ports="*" />


          In the final versin I will be more explicit in the domain and ports of the policy, but are simply trying to get it running at this stage so are using the * wildcards.


          Any help would be greatly appreciated.


          Best Regards