Recent posts by pianomanDylan on Kongregate

Subscribe to Recent posts by pianomanDylan on Kongregate

Jul 11, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Questions about xmlSocket connections

I have been working on a Flash chat client/server application for the past few days of my spare time. It has been working when I open my swf as a local file, as well as when I run it through localhost (I run Apache 2.2). Earlier today I found out how to forward traffic to my computer through my router, so I can view it through my IP address, and have verified that friends outside my network can see it.

But they can’t connect to the socket server that I’m running on my computer. At first I thought it was because the flash was trying to connect to “localhost”, but even when I changed it to connect to (“http://IP.NU.MB.ER” ,9999), the connection fails.

 
Jul 6, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

SUCCESS!! My searches turned up a new site, and this one had an example of a Java-based Policy Server.

http://www.blog.lessrain.com/as3-java-socket-co…

By running that and my own message relay server concurrently, and in my flash, sending a policy request, then trying to connect to the Policy Server, then connecting to the Relay server afterwards, the policy file is accepted, and a connection is made to my port 9999 server!

Turns out that my port 9999 server was sending data that got interpreted as a policy file (even though it was supposed to be a welcome-to-chat message), and then not making a connection because the “policy file” was ignored! Fancy that.

 
Jul 6, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

Well I assumed that wouldn’t work because Flash won’t connect to any port 1024 or below, but here’s the errors that appear in the log as a result of using connect(“localhost”,9999);

OK: Root-level SWF loaded: <a href="http://localhost/xmlServe/xmlSocket.swf">http://localhost/xmlServe/xmlSocket.swf</a>
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://localhost:99 by requestor from <a href="http://localhost/xmlServe/xmlSocket.swf">http://localhost/xmlServe/xmlSocket.swf</a>
Warning: Domain localhost does not specify a meta-policy.  Applying default meta-policy 'all'.  This configuration is deprecated.  See <a href="http://www.adobe.com/go/strict_policy_files">http://www.adobe.com/go/strict_policy_files</a> to fix this problem.
OK: Policy file accepted: <a href="http://localhost/crossdomain.xml">http://localhost/crossdomain.xml</a>
Error: Request for resource at xmlsocket://localhost:99 by requestor from <a href="http://localhost/xmlServe/xmlSocket.swf">http://localhost/xmlServe/xmlSocket.swf</a> has failed because the server cannot be reached.

The meta-policy deal sounds new to me. Any ideas about that?

Or possibly the java program that handles the sockets is accidentally sending out data that Flash thinks is the policy file? That may explain why none of my changes to the xml document are working…

 
Jul 6, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

Thanks for the responses, guys. Here’s what I currently have:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
    <site-control permitted-cross-domain-policies="all"/>
    <allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

And it still doesn’t work. I also tried the one from ExtremePopcorn’s post, as well as the one from the article he linked me to. Niether of them worked for me! (The article’s example would deny me access anyway, but it still left me with the “rejected due to bad syntax” message.)

Could it have something to do with the fact that I’m serving the files from localhost instead of an actual domain name? Or could it be some deeper problem, such as the parser?

 
Jul 5, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

Okay so I looked long and hard at that dang article that Adobe has (which has been completely unhelpful except for the following…) and found out how to get log for my policy files. Apparently it’s finding my file, but ignoring it due to “incorrect syntax”. Here’s a snippet from the log…

Warning: [strict] Ignoring policy file at xmlsocket://localhost:9999 due to incorrect syntax. See http://www.adobe.com/go/strict_policy_files to fix this problem. Error: SWF from http://localhost/xmlSocket.swf may not connect to a socket in its own domain without a policy file. See http://www.adobe.com/go/strict_policy_files to fix this problem.

I visited the specified link, but was automatically redirected to the main article, full of totally useless information. All I found were things that could cause this error, none of which I’m noticing in my own xml file! Here’s the file contents, note that I’ve tried several. If anyone has a working policyfile, PLEASE could you post it so I can see what the parser wants me to write? <?xml version=”1.0” encoding=”UTF-8”?> <cross-domain-policy> <site-control /> <allow-access-from>” headers=”*”/> </cross-domain-policy>

Asterisks in quotes are getting ignored.. could someone also let me know how to get the code/quote block in these forums?

 
Jul 5, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

Thanks, I like my avatar.

I tried putting exactly that in my crossdomain.xml file, but still no change :( Any other ideas?

Does my java program have to actually send the message initially when it first accepts the connection? Or does Apache automatically know what to do?

 
Jul 5, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Programming / Connecting Flash to a Server

Ok here’s the deal: I’m running an apache server so I can test web applications by going to http://localhost I have a program in java that, when running, will accept socket connection requests and handle them, relaying messages back and forth. I have a .swf that tries to open a connection.

When I open the swf as a file right from my computer, the security sandbox says it’s in “LocalTrusted” mode, and connections happen, and the whole thing functions exactly the way I want. But when I open up localhost/xmlSocket.swf, the security sandbox says it is “Remote”, and the connection fails outright.

I’ve been searching on Google for the past TWO DAYS and have determined (I think) that the cause was that I had no policy file anywhere. Well now I have one, called ‘crossdomain.xml’, with this in it:

(the forum formatting is screwing up my XML data. The allow-access thing has “domain”, then ”=”, and an asterisk in quotes, before the ending slash.)

<?xml version=”1.0”?> <cross-domain-policy> <allow-access-from /> </cross-domain-policy>

I also put a loadPolicyFile request in the first line of my code in the swf.

Somehow, it’s STILL not working, and I am baffled, exhausted, and aggravated, and have no idea why it refuses to work. If anyone can help me or if you have any ideas that might help, I’d be extremely grateful!

 
Mar 19, 2008
avatar for pianomanDylan pianomanDylan 8 posts

Topic: Off-topic / The Introduction Thread

Kongregate Name: pianomanDylan

everywhere on the internet Name: pianomanDylan

Age: 19

Location: Troy, New York

Male (how’d you guess?!)

Gaming History: Not a whole lot of online games, except Diablo 2!! Console wise, I currently use a PS2 and occasionally my GameCube. Loved Banjo Kazooie on N64, Played Morrowind and Oblivion on PC.

Flash History: Played plenty of flash games, currently addicted to Desktop Tower Defense but can’t beat Medium Mode :( I like working on my own flash games- I’m currently working on a big one, which I plan on submitting here at Kong and hope it does well.. but it’ll be a while.

How did I hear about Kongregate? My friends were playing Manafold and it looked cool so I visited the site. I became addicted over spring break and now I visit whenever I’m on the internet.