Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

Problem with socket security

$
0
0

Hi,

 

I'm trying to make socket connection from within air application, but no way. I'm browsing google for almost 2 days, follow all possible solutions, but avidently I dont understund somthing cause I'm not able to do anything.

Every time sandbox security violation.....  I need make some simple socket data exchange between my air, and OS. I do not have any web server and no any other kind of network ability. I write down stupid socket server, which is waiting for policy request, and for my other requests (it function 100%, tested with Telnet, so no way to have problem on my socket server side).

 

The strange thing is that my application do not produce any request for socket policy file, neither at 843 port (for default), neither at my custom location with namual

Security.loadPolicyFile("xmlsocket://ip:port"); call

 

This is my primitive code:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical">
    <mx:Script>
        <![CDATA[
            private var s:XMLSocket = null;
               
            private function test():void{
                Security.loadPolicyFile("xmlsocket://127.0.0.1:25013");
                if(!s){
                    s = new XMLSocket();
                    s.addEventListener(DataEvent.DATA, onData);
                    s.addEventListener(Event.ACTIVATE, onActivate);
                    s.addEventListener(Event.CONNECT, onConnect);
                    s.addEventListener(Event.DEACTIVATE, onDeactivate);
                    s.addEventListener(IOErrorEvent.IO_ERROR, onError);
                    s.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurity);
                }
                s.connect("127.0.0.1", 25013);
            }
           
            private function onActivate(e:Event):void{
                debug.text += "Activated\r";
            }
           
            private function onConnect(e:Event):void{
                debug.text += "Connected\r";
                var o:XML = <request cmd="10"/>;
                s.send(o);
            }
           
            private function onDeactivate(e:Event):void{
                debug.text += "Deactivated\r";
            }
           
            private function onError(e:IOErrorEvent):void{
                debug.text += e.text + "\r";
            }
           
            private function onSecurity(e:SecurityErrorEvent):void{
                debug.text += e.text + "\r";
            }
           
            private function onData(e:DataEvent):void{
                debug.text += e.data;
                s.close();
            }
        ]]>
    </mx:Script>
    <mx:Button label="Test" click="test()"/>
    <mx:TextArea id="debug" width="100%" height="100%"/>
</mx:WindowedApplication>

 

Any help will be apresciated.

 

 

Ladislav.


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>