Flash Sockets, securityerror in same domain? - actionscript-3

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 ?

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="*" />

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.

Related

Redis Predis and PHP

I'm working on using Redis with Flash AS3.
I've installed Redis and Predis on a Win7 environment (MSTech for the Redis) and have a RedisAs3 client.
My localHost is 192.168.1.2 and I've configured Redis to listen on 127.0.0.1 and 192.168.1.2.
I only want the AS3 client to subscribe and will eventually get PHP to publish.
Testing in the Flash IDE and using the redisCLI to publish, everything works fine. However, trying my app on my localhost, I get nothing, not connection no error and I can't work out what's going wrong.
Totally new at Redis, Predis but would appreciate some help/guidance.
Solution :
What was missing here was a socket policy file. It's entirely separate from the standard crossdomain policy file and so I needed to serve my app with a socket policy file.
I managered to get a policyFile server running as a windows service from here: https://socketpolicyfile.codeplex.com/
Now works like a charm.. Hope this helps others

simulate as3 crossdomain behavior in localhost

I am writing an action script 3.0 client that has to communicate with a remote server. In localhost environment everything works fine, but if I test the client in the real internet environment there is no connection.
My guess is that it has to do with the cross domain policy file, but calling
Security.loadPolicyFile("xmlsocket://"+targetIP);
does not send the <policy file request\> message to the server on the default 843 port, or any port for that matter. I think it might be because flash recognises that the address is local and omits the request. But I need to receive it to be able to implement the answer on the server. Otherwise I'd be coding blindly.
Is there a way to force the flash client to behave as if it was in a different domain while still being in localhost so I can troubleshoot this issue without involving a remote host? I don't have many resources in that regard.
Try running the client on 'localhost', and load the policy file from '127.0.0.1'.
They should be seen as different 'domains'.

MySQL set server to run not externally for internet

I know, that if I want I could run my application ( C++ or .NET ) , which I've developed internally. I mean, I have an external IP for my PC, but for the security reasons I don't want my application to be seen, so for it, I just set NOT an external IP for the part where I'm binding an IP for a socket, that listening. That is the way how I did my application be seen only internally.
But what for the MySQL server? I scanned my server and see, that MySQL 3306 port is seen. I think it's bad. How can I hide MySQL Server from the public and make it ineternally seen?

Connecting to clients server using TLSSocket using flash as3

I need to connect to client server using TLS Socket connection.
This works fine when I am directly accessing it, i.e through IDE but it gives error if I try accessing it through the browser.
Error:
SecurityError: Error #2010: Local-with-filesystem SWF files are not permitted to use sockets.
Add compiler option use-network=true. You can either load local files or use network, so choose your side.

Connecting to a local socket server from SWF on remote page

I have a Kiosk that connects to a local socket server so it can access some hardware. If the kiosk code is stored locally, it can access the socket perfectly.
However, and I know for good reason, if the kiosk code is hosted on a remote server, it can not access the local socket server because of a sandbox violation.
The problem is that all of these kiosks are hosted on AppEngine, so when I am done making changes, it takes hours to render out to a single HTML file, and change all the css/js location links.
Is there anyway possible for the allow the SWF file to access the local socket server when it is hostel remotely?
Also,
The socket server is a Java app that I dont have the source to. I run it locally through the terminal
I've had the same problem.
The thing is that with Flash player 10 security with sockets has become much stricter. Just placing crossdomain.xml on the server won't do anything - you actually have to send the crossdomain policy file to any client who connects.
The simplest solution is provided by Adobe - they've provided a couple of scripts, one perl and one python, which will set up a policy file server. You can find them here:
Setting up a socket policy server