2010-12-03 87 views
0

我正在運行使用PHP的套接字服務器。套接字服務器運行良好,因爲我可以使用PHP連接到它。閃存/ Flex和PHP套接字應用程序沙盒錯誤

現在,我有一個嘗試連接到其Flash應用程序:

  this.socket.addEventListener(Event.CONNECT, onSocketConnect); 
      this.socket.addEventListener(Event.CLOSE, onSocketClose); 
      this.socket.addEventListener(IOErrorEvent.IO_ERROR, onIOError); 
      this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecError); 

      try { 
       this.socket.connect("myip", 9999); 
      } catch (ioError:IOError) { 
       this.debugLbl.text += "ioError1 "+ioError.message; 
      } catch (secError:SecurityError) { 
       this.debugLbl.text += "secError1 "+secError.message; 
      } 

當我在本地運行應用程序,它的工作原理!但是,當我將其上傳到我的服務器時,我收到了一個沙盒安全錯誤(#2048)。 Flash應用程序實際上與套接字服務器位於同一臺服務器上,並且存在跨域策略文件。

+0

更新:當我運行的Flash應用程序,我的服務器實際接收並接受套接字請求。但是,然後客戶端/ Flash應用程序顯示沙箱錯誤 – 2010-12-03 06:14:24

回答

0

是否需要使用php代理?我必須這樣做,docd here。雖然你確實提到應用程序位於同一臺服務器上,並且存在一個crossdomain.xml,所以我很可能不在那裏(順便說一句,Flash 10需要與prev版本不同的crossdomain.xml,據我所知)。

0

你實際上是在加載跨域策略文件嗎?據我所知,Flash Player只會嘗試自動加載以下文件:http://www.example.com/crossdomain.xml。如果你的文件是在另一個地方,你應該加載:

Security.loadPolicyFile("http://www.example.com/subfolder/crossdomain.xml"); 

而且,即使該應用程序是在同一臺服務器上,Flash Player將認爲「http://www.example.com」是從不同「http://example.com」,所以你應該確保你掩蓋這種可能性在跨域策略文件:

<allow-access-from domain="*.example.com"/>