Socket AS3 Lectura SocketsBytes como BytesArray

I'm sen to server socket an Array from swf, (using writeObject) and server resend to all clients (its not any process on bytes). But at swf side I'm not read this array. What can i do to solve this problem.

Mis códigos:

fl_socket.addEventListener(ProgressEvent.SOCKET_DATA, veri_geldi);

function veri_geldi(e:ProgressEvent):void
    {
        if (fl_socket.bytesAvailable > 0)
        {

            GELEN_VERI = fl_socket.readUTFBytes(fl_socket.bytesAvailable);
            veri_tipi = GELEN_VERI.split(';');
            switch (veri_tipi[0])
            {
                case "DURUM_BILGISI" :
                    durum_bilgisi.text = GELEN_VERI;
                    break;
//Other Cases
                default :
                //it's not work after this line...
                GELEN_BYTES = e.target.data; // "GELEN_BYTES" as a ByteArray

                    Dsteps2 = GELEN_BYTES.readObject(); // Dsteps2 as an Array

                    durum_bilgisi.text = Dsteps2[0].toString() + "|" + Dsteps2[1].toString();
                    break;
            }
        }
    }

preguntado el 26 de agosto de 12 a las 23:08

1 Respuestas

e.target.data is not a ByteArray but Socket and You read all received bytes at line :

GELEN_VERI = fl_socket.readUTFBytes(fl_socket.bytesAvailable);

Do not expect any data in line :

Dsteps2 = GELEN_BYTES.readObject();

... because You already read last aviable data .

Respondido 27 ago 12, 08:08

You must know what are You reading , or copy bytes to new ByteArray and than make operations . - turbosqel

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.