Esempio n. 1
0
        void OnGTLoginAck(LPSocker socker, byte[] buf, int length)
        {
            bool          result = false;
            T2C_LOGIN_ACK msg    = null;

            msg = new T2C_LOGIN_ACK();
            if (LOG_ERROR(msg != null))
            {
                goto Exit0;
            }

            result = m_RecvMessageSerializer.Init(null, 0, buf, length);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            result = msg.UnSerialize(m_RecvMessageSerializer);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            LP.Logger.IMP("recv gateserver login ack, login successfully !");
            LP.Logger.IMP("T2C_LOGIN_ACK(byValue={0},wValue={1},dwValue={2},qwValue={3},szValue={4})",
                          msg.byValue, msg.wValue, msg.dwValue, msg.qwValue, msg.sValue);

Exit0:

            result = m_RecvMessageSerializer.UnInit();
            LOG_ERROR(result);

            return;
        }
Esempio n. 2
0
        ////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////
        bool DoGTLoginReq(LPSocker socker)
        {
            bool          result = false;
            C2T_LOGIN_REQ msg    = null;

            msg = new C2T_LOGIN_REQ();
            if (LOG_ERROR(msg != null))
            {
                goto Exit0;
            }
            msg.MsgId   = (UInt16)C2T_MESSAGE_ID.c2t_login_req;
            msg.byValue = 1;
            msg.wValue  = 2;
            msg.dwValue = 3;
            msg.qwValue = 4;
            msg.sValue  = "I'm client, i want to login !";

            result = m_SendMessageSerializer.Init(null, 0, null, 0);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            result = msg.Serialize(m_SendMessageSerializer);
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            result = socker.Send(m_SendMessageSerializer.GetSerializeBuf(), 0, m_SendMessageSerializer.GetSerializeSize());
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            result = m_SendMessageSerializer.UnInit();
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            return(true);

Exit0:

            result = m_SendMessageSerializer.UnInit();
            if (LOG_ERROR(result))
            {
                goto Exit0;
            }

            return(false);
        }