I am trying to create an desktop application, to connect FTP server using Socket connection and transfer data / assets between server and client.
For that I am using following flow:
var commandSocket:Socket = new Socket();
commandSocket.addEventListener(ProgressEvent.SOCKET_DATA, onSocketData);
commandSocket.addEventListener(Event.CONNECT, onSocketConnect);
commandSocket.addEventListener(IOErrorEvent.IO_ERROR, function(e:IOErrorEvent):void
{
Console.error("Command socket error: " + e.toString());
});
commandSocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(e:SecurityErrorEvent):void
{
Console.error("Command socket error: " + e.toString());
});
commandSocket.addEventListener(Event.CLOSE, function(e:Event):void
{
Console.progress("Command socket closed");
});
Security.loadPolicyFile("xmlsocket://xx.xx.xx.xx:1080");
commandSocket.connect(xx.xx.xx.xx, 1080);
Befor connecting to server sending an request to load Socket policy file. For that I have set an crossdomain.xml file in the FTP folder on server. For more detail refer the refer the crossdoamin below:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="1080" />
</cross-domain-policy>
I am sending USER, PASS etc commands to server and its responds fine. But when I try to upload any assets then its give me the error:
Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: app:/Test.swf cannot load data from xx.xx.xx.xx:30072.
Thanks