Socket policy files work a little differently than HTTP policy files; in particular, they are not served over HTTP or on port 80.
Instead, Flash Player checks the policy file server (port 843 by default) or, if necessary, the socket you open (for you, port 2222).
A policy file server is a socket that responds to <policy-file-request/> with a valid policy file. What happens to your message, it is likely that it sends its request and receives something other than a policy file, and therefore the invalid syntax from port 2222.
There are a lot of resources and a number of questions here on SO . Here is one tutorial from Adobe.
source share