Reputation: 27
I am trying to connect a flash socket client to a c++ socket server ( using boost::asio ). I always run the server app on the distant server listening on port 7171.
The connection works fine if I run the flash socket client on my local machine ( directly inside CS5.5 ). After this successful test, I decided to upload my swf to the same machine as the socket server, to allow multiple users to connect it throught HTTP ( then I suppose flash client and c++ server are inside same domain ), but in this case, I always get a SecurityError 2048.
What could I be missing ?
Upvotes: 0
Views: 783
Reputation: 6403
When you test locally you are in your sandbox which will ignore security issues, that is why it will not work when uploaded( outside of sandbox ).
In your ActionScript you need to include this.
// host is something like dev.mydomain.com
Security.allowDomain( host );
Security.loadPolicyFile( "xmlsocket://" host + ":" port );
On the port you need to listen for this request
<policy-file-request/>
When you get the request for the policy you need to return a cross domain policy with with this node.
<allow-access-from domain="*" to-ports="*" />
Upvotes: 2
Reputation: 3199
Flash requires a policy server to be running on the hosting machine to access any sockets:
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html
This is a separate requirement from a crossdomain file-- it requires an actual policy server app running on port 843.
It may be that Flash inside CS5 ignores the policy requirement because it knows that it's in a development environment.
Upvotes: 0