2 Replies Latest reply on Nov 28, 2011 3:30 AM by HenriqueCanova

    Socket Available Data

    HenriqueCanova

      Hi

       

      I'm Trying to use socket connection in Adobe Flash Builder 4.5 an works great, but i have problems with some packs like this one (Wireshark Image)

       

      Sem título.png

       

      Is one pack with 31 Bytes but the socket.avaliablebytes return every time 0, I use the code below

       

       

       

      public function init() : void

                                    {

                                                   socket = new Socket();

                                                   var PORTA:Number = new Number(porta_text.text);

                                              try

                                              {

                                                             estado.text=("Trying to connect to \n");

       

                                                             socket.connect(ip_text.text, PORTA);

                                              }

                                              catch (error:Error)

                                              {

                                                             estado.text=(error.message + "\n");

                                                             socket.close();

                                              }

       

                                                   socket.addEventListener(Event.CONNECT, onConnect);

                                                   socket.addEventListener(Event.CLOSE, onClose);

                                                   socket.addEventListener(ProgressEvent.SOCKET_DATA, onSocketData);

                                    }

       

       

      private function onSocketData(event : ProgressEvent) : void

      {

       

                                              while (socket.bytesAvailable)

                                              {

                                                   txtResponse.text += socket.readUTFBytes(socket.bytesAvailable);

        }

      }

       

       

       

      Anyone have idea why I can't read this pack.

       

      Thanks a lot.