Flash doesn't connect to socket even though policy allows it

Posted by Bart van Heukelom on Stack Overflow See other posts from Stack Overflow or by Bart van Heukelom
Published on 2010-12-31T14:44:20Z Indexed on 2011/01/08 22:54 UTC
Read the original article Hit count: 280

In my Flash app, I'm connecting to my server like this:

Security.loadPolicyFile("xmlsocket://example.com:12860");
socket = new Socket("example.com", 12869);
socket.writeByte(...);
...
socket.flush();

At port 12860 I'm running a socket policy server, which (according to this document) correctly serves up my policy like this:

00000000  3c 70 6f 6c 69 63 79 2d  66 69 6c 65 2d 72 65 71 <policy- file-req
00000010  75 65 73 74 2f 3e 00                             uest/>.
    00000000  3c 63 72 6f 73 73 2d 64  6f 6d 61 69 6e 2d 70 6f <cross-d omain-po
    00000010  6c 69 63 79 3e 3c 73 69  74 65 2d 63 6f 6e 74 72 licy><si te-contr
    00000020  6f 6c 20 70 65 72 6d 69  74 74 65 64 2d 63 72 6f ol permi tted-cro
    00000030  73 73 2d 64 6f 6d 61 69  6e 2d 70 6f 6c 69 63 69 ss-domai n-polici
    00000040  65 73 3d 22 6d 61 73 74  65 72 2d 6f 6e 6c 79 22 es="mast er-only"
    00000050  20 2f 3e 3c 61 6c 6c 6f  77 2d 61 63 63 65 73 73  /><allo w-access
    00000060  2d 66 72 6f 6d 20 64 6f  6d 61 69 6e 3d 22 2a 22 -from do main="*"
    00000070  20 74 6f 2d 70 6f 72 74  73 3d 22 31 32 38 36 39  to-port s="12869
    00000080  22 20 2f 3e 3c 2f 63 72  6f 73 73 2d 64 6f 6d 61 " /></cr oss-doma
    00000090  69 6e 2d 70 6f 6c 69 63  79 3e 00                in-polic y>.

I get no security warnings, which I used to get before the policy server was in place. Still, the connection to port 12869 doesn't work. It's made (I can see with Wireshark and on the server), but no data is sent by Flash.

It might be worth knowing that the SWF itself is served from example.com as well.

© Stack Overflow or respective owner

Related posts about flash

Related posts about security