0

I'm having this problem when i want to send using socket a message...

textField.addEventListener(KeyboardEvent.KEY_DOWN,enterHandler);

  function enterHandler(event:KeyboardEvent):void{
        if(event.keyCode == Keyboard.ENTER ){
            socket.writeUTF(textField.text);
            socket.flush();
            trace(textField.text); //the output is what input text is, so the input field is right
        }
    }

The error is this : Error: Error #2030: End of file was encountered. at flash.utils::ByteArray/readUnsignedByte() at socket_fla::MainTimeline/closeListener()

Any Idea?

Edit: After checking the Java server (RedDwarf) that the client is connected to, it shows that the Message is received, then SEVERE: unknown opcode 0x61 Tried googling it, nothing..

4

1 回答 1

0

当您在服务器的套接字上没有 addEventListener(ProgressEvent.SOCKET_DATA, data) 时,可能会导致此问题。您必须在获得数据后读取数据。

于 2014-07-17T09:45:10.377 回答