t();34 //同意关闭35 // if(_recvPackageType == 5)36 // {37 // close();38 // }39 _recvPackageSize=_socket.readInt();40 _isReadHead=true;41 }42 if (_isReadHead && _socket.bytesAvailable >= _recvPackageSize)43 {44 var byte:ByteArray=new ByteArray();45 _socket.readBytes(byte, 0, _recvPackageSize);46 _msgObj=byteArraytoObject(byte);47 //暂时用上面一种 48 if (_recvPackageType == packageType.LOGIN_TYPE)49 {50 if (_msgObj.ret == bodyType.RECEIVE_OK)51 {52 _timerDetectSocket.start();53 socketState=socket_state_connected;54 myEventDispatch.Instence().dispatcher(bodyType.INLINE_CURRENTSOCKETSTATE);55 }56 else if (_msgObj.ret == bodyType.RECEIVE_ERROR)57 {58 close();59 }60 61 }62 else if (_recvPackageType == packageType.CHAT_TYPE)63 {64 myEventDispatch.Instence().dispatcher(selectEventName(_recvPackageType), _msgObj);65 }66 _recvPackageSize=0;67 _recvPackageType=0;68 _msgObj=null;69