Ciao ha tutti, ho un problemino con flash e adobe AIR nell'inviare dati via FTP:
Ho una socket per i comandi con cui invio i vari comandi (USER, PASS, PASV) E FUNZIONa perfettamente, dopo il comando PASV creo una nuova socket dati e la uso per connettermi e funziona, o almeno genera l'evento Event.CONNECT.

Subito dopo però non funzionano più i comandi!
I comandi che invio tramite la socket comandi smettono di andare, non ottengo piu nessuna risposta, ne positiva ne di errore, in pratica vengo completamente ignoratoAnche usando il comando list non cambia niente.

QUESTO E IL CODICE

Codice:
import flash.events.Event;
            import flash.events.IOErrorEvent;
            import flash.events.MouseEvent;
            import flash.events.ProgressEvent;
            import flash.events.SecurityErrorEvent;
            import flash.net.Socket;
            import flash.utils.Endian;

            protected var s:Socket;            // socket comandi
            protected var s_dati:Socket;
            protected function btn_connetti_clickHandler(event:MouseEvent):void
            {
                
                function connesso(evt:Event):void    {
                    //label_stato.text += "Connesso!";
                    
                    // ora che la socket è connessa invia user e password
                    s.writeUTFBytes("USER [email protected]\n");
                    s.writeUTFBytes("PASS oscurato\n");
                    
                    // apre un canale dati passivo
                    s.writeUTFBytes("PASV\n");
                }
                
                function connessoDati(evt:Event):void    {
                    label_stato.text += "Socket dati connessa!";
                    
                    
                    s.writeUTFBytes("HELP \n");
                }
                
                function riceviDati(evt:ProgressEvent):void    {
                    label_stato.text += "DATI -> "+ s_dati.readUTFBytes(evt.bytesLoaded);
                }
                
                function erroreSicurezza(evt:SecurityErrorEvent):void    {
                    label_stato.text = "Errore nella sicurezza "+evt.text;
                }
                
                function progresso(evt:ProgressEvent):void    {
                    var str:String = s.readUTFBytes(evt.bytesLoaded);
                    label_stato.text += str;
                    var arrS:Array = str.split("\n");
                    for (var i:int = 0; i<arrS.length; i++)    {
                        //if(arrS[i])
                        //label_stato.text += "->"+arrS[i]+"\n";
                        var tmps:String = arrS[i].toString();
                        if(tmps.substr(0,3) == "227")    {
                            label_stato.text += tmps+"\n";
                            var IPport:String = tmps.substring( tmps.indexOf("("), tmps.indexOf(")") );
                            var numeri:Array = IPport.split(",");
                            var porta:Number = 0;    // numero di porta;
                            var LSB:Number = numeri[numeri.length-1];
                            var MSB:Number = numeri[numeri.length-2];
                            //numeri[numeri.length-1] = numeri
                            label_stato.text += "Connessione passiva\n" + MSB+ " " + LSB+"\n";
                            porta = (MSB *256) + LSB;
                            //label_stato.text += "Porta: "+porta;
                            
                            s_dati.connect("ftp.fileuniverse.it", porta);
                        }
                    }
                }
                
                function erroreIO(evt:IOErrorEvent):void    {
                    label_stato.text += "\nERRORE " + evt.text;
                }
                
                // crea la socket
                s = new Socket();
                s_dati = new Socket();
                
                // gestione eventi
                s.addEventListener(Event.CONNECT, connesso);
                s.addEventListener(ProgressEvent.SOCKET_DATA, progresso);
                s.addEventListener(IOErrorEvent.IO_ERROR, erroreIO);
                s.addEventListener(SecurityErrorEvent.SECURITY_ERROR, erroreSicurezza);
                s_dati.addEventListener(Event.CONNECT, connessoDati);
                s_dati.addEventListener(ProgressEvent.SOCKET_DATA, riceviDati);
                s_dati.addEventListener(IOErrorEvent.IO_ERROR, erroreIO);
                s_dati.addEventListener(SecurityErrorEvent.SECURITY_ERROR, erroreSicurezza);
                s.connect("ftp.fileuniverse.it", 21);
            }


            protected function btn_dati_clickHandler(event:MouseEvent):void
            {
                label_stato.text += tx_comandi.text+"\n";
                s.writeUTFBytes(tx_comandi+"\n");
            }
Perchè appena la socket dati si connette alla porta suggerita dal server non mando più comandi?