Cannot connect to socket in same domain
I have a Flex web app (compiled to regular SWF) that tries to connect to a (binary, not XML) socket on its own server. So if the swf is at example.com/app.swf
, 开发者_StackOverflowthe socket is example.com:12869
This should be possible, AFAIK, but when I try to connect I get a security error saying that example.com/app.swf
cannot access example.com:12869
.
Even though it shouldn't be needed, I also have a crossdomain.xml
file containing
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*"/>
</cross-domain-policy>
but it doesn't help.
What can I do?
You can see the app here.
You could use my Apache 2 module - it listens at the port 843 and answers socket policy requests
The thing is that by default Flash will request the policy from the socket, meaning it sends <policy-file-request/>
to the Socket - if you have the possibility to add it to your server implementation, you can have a look at how that guy fixed the same sort of problem.
You can also use Security.loadPolicyFile("http://axa3.axastudios.nl/crossdomain.xml")
before initiating the socket connection to force it to load your policy first. I'm not 100% sure if this works for Socket connections though, the docs (search for "Socket policy files") are slightly confusing.
精彩评论