Issue with binary socket- policy file on a Server

I have a unique problem, I am attempting to setup a binary socket connection between flash running on my desktop and a Rabbit RCM3800 Microcontroller providing the server on my home network, which has no file system and has a very basic http server on it. My problem is Flash times out while waiting for the policy file and I can’t figure out how to get it to accept the file I send.

Due to limitations of the microC I cannot run Java/Perl/Python or any other server on it other than setting up a server using its own native Dynamic C language (essentially manually opening and controlling sockets in C). I am able to successfully connect to a socket on port 3333 of the server and transfer information between the server and the .swf file when it is the sandbox type “local-trusted” (while I’m debugging in Flash). Because of this I’m fairly certain the code to setup the socket between the server and flash works fine.

My problem occurs when I try to run the .swf file as “local-with-network” (such as running it after publishing on my desktop) or “remote” (accessing the .swf file when it is located on the server) and it then requires a socket policy server to host a socket policy file on the server. On my server I have code setup such that whenever a socket opens on port 843 or port 3333 (my data port) and sends a stream of raw data containing the request <policy-file-request/>, the server writes back in ASCII the below code and closes the socket.


<?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="*" to-ports="*" />
</cross-domain-policy>\0

The flash SECURITY_ERROR property returns:

securityErrorHandler: [SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048: Security sandbox violation: file:///C:/myProg.swf cannot load data from 192.168.1.59:3333."]

I also have logging setup on my system, and the policyfiles.txt logfile displays:

OK: Root-level SWF loaded: file:///C:/myProg.swf
OK: Searching for <allow-access-from> in policy files to authorize data loading from resource at xmlsocket://192.168.1.59:3333 by requestor from file:///C:/myProg.swf
Warning: Timeout on xmlsocket://192.168.1.59:843 (at 3 seconds) while waiting for socket policy file.  This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
Warning: Timeout on xmlsocket://192.168.1.59:3333 (at 3 seconds) while waiting for socket policy file.  This should not cause any problems, but see http://www.adobe.com/go/strict_policy_files for an explanation.
Error: Request for resource at xmlsocket://192.168.1.59:3333 by requestor from file:///C:/myProg.swf is denied due to lack of policy file permissions.

So for some reason flash times out while waiting for the socket policy file. I have tested sending the over telnet, and have received the above policy file. I have also sniffed using wireshark and saw that my desktop sent the policy request and received the policy file. I am guessing that Flash times out because it is waiting for some kind of terminating character that states the end of the policy file, and to that end I have tried sending \r
and \0.

Interestingly, instead of sending the policy file I have tried sending random data from the server to flash, and flash displayed the Warning: Ignoring policy file at (URL) due to incorrect syntax. Because I don’t receive this warning when I send my policy file I don’t think it is formatted incorrectly. I have also tried using the below flash code to hold the socket request open indefinitely, but it also errors after 20seconds.

Security.loadPolicyFile("xmlsocket://192.168.1.59:843");

The .swf file will eventually reside on the server itself at 192.168.1.59/myProg.html. I have only tested the flash file remotely on the server a couple times, and in addition to the previous warnings/errors, I received the warning: SWF from (URL) may not connect to a socket in its own domain without a policy file.

If anyone has any idea what my problem could be I could really use the help! I can also post my flash code or my server code to help figure out what the issue is. Thanks!

-James