I am basically using a debian server that i built to do all this. I am not going to go into detail on all the code now but i would like to talk about some of the pitfalls that cost me time in doing this.
PITFALL 1: security sandbox
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox
I had done cross server stuff with flash before, and i was aware of how to use crossdomain.xml. I did not know that when doing transactions through a socket (even locally, serving the file from the same machine java is running on) that i would have to use a different type of policy file..the as3 code i had to use is:
System.security.loadPolicyFile("xmlsocket://localhost:8080");
PITFALL 2: Policy Server, your kidding right
Ok kiddies, in order to have Flex/Flash talk to your java server, you need to write a server to serve the policy file... Or have your admin install one. I tried the ones that adobe mentions and they where not working for me. I ended up writing my own in perl and it is working nicely (still early in testing though). Basically your going to sever a policy back to the flash app that looks a bit like this:
<cross-domain-policy>
<allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
pretty basic stuff. I am guessing adobe is making this a pain in the ass so they can sell us a as3 server or something... Maybe an air server that is for more than desktop apps or something like that... <allow-access-from domain="*" to-ports="*" />
</cross-domain-policy>
PITFALL 3: iPv6
This one resulted in me losing alot of hair. I really have to read up on iPv6 because i have no idea why it was screwing up my java socket server but it was. I completely rewrote my java server for no reason because of this. It turns out that IpV6 was banging up my java socket server so i had to disable it via adding:
net.ipv6.conf.all.disable_ipv6 = 1 The final product is pretty cool, i am passing xml from the Flex front to the Java server. I am probably going to build upon this to write a chat server so i can explore passing data both ways. In the short run i should be able to build some pretty bad as forms that dont require page refreshes to post.
No comments:
Post a Comment