Comunidad de diseño web y desarrollo en internet online

Ayuda plz, no se por que no funciona!

Citar            
MensajeEscrito el 14 May 2008 09:50 pm
Hola soy algo nuevo en flash

descarge el codigo de Telnet Socket de flash c3 que la la web de adobe.
nien cuando corro el swf en mi equipo funciona muy bien, pero duando lo subo a el servidor sale este error.

Código :

Error #2044: SecurityErrorEvent no controlado: text=Error #2048: Violación de la seguridad Sandbox: http://201.245.2.158/skytel/SkyTel.swf no puede cargar datos desde 190.24.231.158:23.
   at com.socket::Telnet()[\\\\\\\\\\\\\\\\Servidor\\\\\\\\www\\\\\\\\SkyTel\\\\\\\\com\\\\\\\\socket\\\\\\\\Telnet.as:34]
   at TelnetSocket/connect()[\\\\\\\\\\\\\\\\Servidor\\\\\\\\www\\\\\\\\SkyTel\\\\\\\\TelnetSocket.as:16]


ya puse el crossdomain.xml pero sigue saliendo.
no se como lo puedo solucionar.

estos son los codigos de los .as

TelnetSocket.as

Código :

package 
{
   import flash.display.Sprite;
   import flash.utils.ByteArray;
   import flash.events.MouseEvent;
   import com.socket.Telnet;   
   
   public class TelnetSocket extends Sprite 
   {
        private var telnetClient:Telnet;

      public function TelnetSocket() {
         setupUI();
      }
      private function connect(e:MouseEvent):void {
         telnetClient = new Telnet(serverName.text, int(\\\"23\\\"), output);
         var ba:ByteArray = new ByteArray();
         ba.writeMultiByte(\\\"admin\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(ba);
         var pass:ByteArray = new ByteArray();
         pass.writeMultiByte(\\\"admin\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(pass);
      }
      private function sendCommand(e:MouseEvent):void {
         var ba:ByteArray = new ByteArray();
         ba.writeMultiByte(command.text + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(ba);
         command.text = \\\"\\\";
      }
      private function arp(e:MouseEvent):void {
         var ba:ByteArray = new ByteArray();
         ba.writeMultiByte(\\\"s i a\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(ba);
         command.text = \\\"\\\";
      }
      private function pe(e:MouseEvent):void {
         var ba:ByteArray = new ByteArray();
         ba.writeMultiByte(\\\"s i i\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(ba);
         command.text = \\\"\\\";
      }
      private function dns(e:MouseEvent):void {
         var co:ByteArray = new ByteArray();
         co.writeMultiByte(\\\"co\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(co);
         var dns:ByteArray = new ByteArray();
         dns.writeMultiByte(\\\"dns view\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(dns);
         var q:ByteArray = new ByteArray();
         q.writeMultiByte(\\\"q\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(q);
      }
      private function maps(e:MouseEvent):void {
         var co:ByteArray = new ByteArray();
         co.writeMultiByte(\\\"co\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(co);
         var dns:ByteArray = new ByteArray();
         dns.writeMultiByte(\\\"ip-maps view\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(dns);
         var q:ByteArray = new ByteArray();
         q.writeMultiByte(\\\"q\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(q);
      }
      private function hole(e:MouseEvent):void {
         var co:ByteArray = new ByteArray();
         co.writeMultiByte(\\\"co\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(co);
         var dns:ByteArray = new ByteArray();
         dns.writeMultiByte(\\\"pinhole view\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(dns);
         var q:ByteArray = new ByteArray();
         q.writeMultiByte(\\\"q\\\" + \\\"\\\\n\\\", \\\"UTF-8\\\");
         telnetClient.writeBytesToSocket(q);
      }
      private function setupUI():void {
         loginBtn.addEventListener(MouseEvent.CLICK,connect);
         sendBtn.addEventListener(MouseEvent.CLICK,sendCommand);
         arpBtn.addEventListener(MouseEvent.CLICK,arp);
         peBtn.addEventListener(MouseEvent.CLICK,pe);
         dnsBtn.addEventListener(MouseEvent.CLICK,dns);
         mapsBtm.addEventListener(MouseEvent.CLICK,maps);
         holeBtn.addEventListener(MouseEvent.CLICK,hole);
      }      
   }
}


y Telnet.as

Código :

package com.socket {
    import flash.events.*;
    import flash.net.Socket;
    import flash.system.Security;
    import flash.utils.ByteArray;
    import flash.utils.setTimeout;
    
    import fl.controls.TextArea;
    import fl.core.UIComponent;
   //output.setStyle( \\\"backgroundColor\\\", \\\"white\\\" );


    public class Telnet {
        private const CR:int = 13; // Carriage Return (CR)
        private const WILL:int = 0xFB; // 251 - WILL (option code)
        private const WONT:int = 0xFC; // 252 - WON\\\'T (option code)
        private const DO:int   = 0xFD; // 253 - DO (option code)
        private const DONT:int = 0xFE; // 254 - DON\\\'T (option code)
        private const IAC:int  = 0xFF; // 255 - Interpret as Command (IAC)

        private var serverURL:String;
        private var portNumber:int;
        private var socket:Socket;
        private var ta:TextArea;
        private var state:int = 0;
        
        public function Telnet(server:String, port:int, output:TextArea) {
            // set class variables to the values passed to the constructor.
            serverURL = server;
            portNumber = port;
         ta = output;
         
            // Create a new Socket object and assign event listeners.
            socket = new Socket();
            socket.addEventListener(Event.CONNECT, connectHandler);
            socket.addEventListener(Event.CLOSE, closeHandler);
            socket.addEventListener(ErrorEvent.ERROR, errorHandler);
            socket.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
            socket.addEventListener(ProgressEvent.SOCKET_DATA, dataHandler);
            
            // Load policy file from remote server.
            Security.loadPolicyFile(\\\"http://201.245.2.158/crossdomain.xml\\\");
            // Attempt to connect to remote socket server.
            try {
                msg(\\\"Conectando con \\\" + serverURL + \\\":\\\" + portNumber + \\\"\\\\n\\\");
                socket.connect(serverURL, portNumber);
            } catch (error:Error) {
                
//                    Unable to connect to remote server, display error 
//                    message and close connection.
//                
                msg(error.message + \\\"\\\\n\\\");
                socket.close();
            }
        }
        
        /**
         * This method is called if the socket encounters an ioError event.
         */
        public function ioErrorHandler(event:IOErrorEvent):void {
            msg(\\\"Imposible conectar: error en el socket o en el puerto 23.\\\\n\\\");
        }
        
        /**
         * This method is called by our application and is used to send data
         * to the server.
         */
        public function writeBytesToSocket(ba:ByteArray):void {
            socket.writeBytes(ba);
            socket.flush();
        }
        
        private function connectHandler(event:Event):void {
            if (socket.connected) {
                msg(\\\"conectando...\\\\n\\\");
            } else {
                msg(\\\"desconectado\\\\n\\\");
            }
        }
        
        /**
         * This method is called when the socket connection is closed by 
         * the server.
         */
        private function closeHandler(event:Event):void {
            msg(\\\"desconectado...\\\\n\\\");
        }
        
        /**
         * This method is called if the socket throws an error.
         */
        private function errorHandler(event:ErrorEvent):void {
            msg(event.text + \\\"\\\\n\\\");
        }
        
        /**
         * This method is called when the socket receives data from the server.
         */
        private function dataHandler(event:ProgressEvent):void {
            var n:int = socket.bytesAvailable;
            // Loop through each available byte returned from the socket connection.
            while (--n >= 0) {
                // Read next available byte.
                var b:int = socket.readUnsignedByte();
                switch (state) {
                    case 0:
                        // If the current byte is the \\\"Interpret as Command\\\" code, set the state to 1.
                        if (b == IAC) {
                            state = 1;
                        // Else, if the byte is not a carriage return, display the character using the msg() method.
                        } else if (b != CR) {
                            msg(String.fromCharCode(b));
                        }
                        break;
                    case 1:
                        // If the current byte is the \\\"DO\\\" code, set the state to 2.
                        if (b == DO) {
                            state = 2;
                        } else {
                            state = 0;
                        }
                        break;
                    // Blindly reject the option.
                    case 2:
                        /*
                            Write the \\\"Interpret as Command\\\" code, \\\"WONT\\\" code, 
                            and current byte to the socket and send the contents 
                            to the server by calling the flush() method.
                        */
                        socket.writeByte(IAC);
                        socket.writeByte(WONT);
                        socket.writeByte(b);
                        socket.flush();
                        state = 0;
                        break;
                }
            }
        }
        
        /**
         * Append message to the TextArea component on the display list.
         * After appending text, call the setScroll() method which controls
         * the scrolling of the TextArea.
         */
        private function msg(value:String):void {
            ta.text += value;
            ta.dispatchEvent(new Event(Event.CHANGE));
            setTimeout(setScroll, 100);
        }


         * Scroll the TextArea component to its maximum vertical scroll 
         * position so that the TextArea always shows the last line returned
         * from the server.
         */
        public function setScroll():void {
//            ta.verticalScrollPosition = ta.maxVerticalScrollPosition;
            ta.verticalScrollPosition = ta.maxVerticalScrollPosition;
        }
    }
}

Por k1k3

5 de clabLevel



 

firefox
Citar            
MensajeEscrito el 15 May 2008 01:20 pm

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.