Flash Player Security Policy and port problems have always been a headache for web development of socket (xmlsocket). After a day of research yesterday, we finally found a solution, I will briefly describe the solution here!
In fact, flash help files are also explained: http://help.adobe.com/zh_CN/AS3LCR/Flash_10.0/flash/system/Security.html#loadPolicyFile ()
. The security. loadpolicyfile ("xmlsocket: // localhost: 110") is used to load the security policy content before the socket. Connect method is called. The player sends a request to the server <policy-file-Request/>
And ends with NULL bytes. The server also returns the security policy content terminated with NULL bytes.
The security policy text is as follows:
<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype cross-domain-Policy System "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd
">
<Cross-domain-Policy>
<Site-control permitted-Cross-Domain-policies = "all"/>
<Allow-access-from domain = "*" to-ports = "*"/>
</Cross-Domain-Policy>
On the server side, we need to make a difference with amf3. Check whether the request contains "<policy-file-Request/>
", And then return the Security Policy text content. Note that the returned content must be ended in NULL bytes!